dimanche 27 septembre 2015

How to call a model function inside the controller in Laravel 5

I have been facing a problem of not able to use the model inside the controller in the new laravel framework version 5. i created the model using the artisan command "php artisan make:model Authentication" and it created the model successfully inside the app folder, after that i have created a small function test in it, and my model code looks like this.

 <?php namespace App;

 use Illuminate\Database\Eloquent\Model;

 class Authentication extends Model {

   protected $table="canteens";

   public function test(){
    echo "This is a test function";
   }

}

Now i have no idea, that how shall i call the function test() of model to my controller , Any help would be appreciated, Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VgLlj0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire