Thursday 7 July 2016

PHP Laravel MySql Functions

0. App\Article::all()->toArray();
1. App\Article::find(1);
2. App\Article::find(1)->toArray();
3. App\Article::where('user_id','1')->get();  It gives Collection
4. App\Article::where('user_id','1')->first(); It gives Single record
5. $fillable method in model to allow create Query on [tinker] terminal
6. Update Attribute of table :
             $article = App\Article::find(2);
             $article->field_name = 'field value';
             $article->save();
                                            OR
             $article = App\Article::find(2);
             $article->update(['field_one'=>'Update again']);

            


No comments:

Post a Comment