get all data laravel code example
Example 1: laravel fillable
protected $fillable = [
'title',
'slug',
'body',
'image',
'published',
'comments_open'
];
Example 2: DB::table('users')->get(); id 1
$users = DB::table('users')where('id','=', $userid)->get();
Example 3: get all data eloquent laravel
Blog::all();
$posts = Blog::all();
Example 4: laravel where
$users = DB::table('users')
->whereMonth('created_at', '12')
->get();
Example 5: laravel find query
return Destination::orderByDesc(
Flight::select('arrived_at')
->whereColumn('destination_id', 'destinations.id')
->orderBy('arrived_at', 'desc')
->limit(1)
)->get();
Example 6: laravel where
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();