jeudi 26 mai 2016

Find method dose not work in laravel controller

I have controller like this

 $test= test::find($id);  
 return $test;

return null but when I change it to

 $test= test::where('id',$id)->get();
 return $test;

return all value of $test My migration is

 Schema::create('tests', function (Blueprint $table) {

        $table->increments('id');
        $table->string('user', 20);
 }),

This is my model:

 public $fillable = [
    'user'
  ];



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire