get all record in laravel code example
Example 1: get all data eloquent laravel
Blog::all();
$posts = Blog::all();
Example 2: laravel eloquent get all records where
Model::get();
$cars = App\Models\Cars::get();
Model::where('column', {value})->get();
$blue_cars = App\Models\Cars::where('color', 'blue')->get();
$looking_for = 'green';
$green_cars = App\Models\Cars::where('color', $looking_for)->get();
Model::where('column', {condition}, {value})->get();
$antiques = App\Models\Cars::where('year', '<=', 2000)->get();
$green_antiques = App\Models\Cars::where(
[
['color', 'green'],
['year', '<=', 2000],
]
)->get();
Model::where('column', {value})->cursor();
Model::where('column', {value})->limit({n})->get();
$some_green_cars =
App\Models\Cars::where('color', 'green')->limit(10)->get();