samedi 24 décembre 2016

Laravel orm database query inside model function

I am new in Laravel. I want to make some custom functions in models which is related to database query.

Class A Extends Controller{
  public function view(){
    B::get_user();
  }
}

Class B Extends Model{
  protected $table = "user";

  public function get_user(){
    //Here is my database query
  }
}

How can I use database query in get_user() function? I know this method:

B::table('user')->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire