php - Why we use functions in model? -


i doing project in laravel , saw there functions in models. hard me because don't know why here.

for example function like:

public function lowest() {     return $this->prices->min('price'); } 

can explain me this?

you getting down-votes because not stack overflow question support on code issues. inquisitive question. i'd point laracasts learn more. short answer, model might represent idea or object. let's talking person. person belongs family, function might return instance of family can list of people in family. person can have many kids. rather store these kids in array in field, these kids can other people too, , method on model can called return objects representing each kid person.

this long concept explain, recommend researching on site geared learning/researching , not debugging/fixing.

hopefully answer gets started though!


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -