laravel query with() code example
Example 1: laravel sql query
use Illuminate\Support\Facades\DB;
$users = DB::select('select * from users');
foreach ($users as $user) {
echo $user->name;
}
Example 2: Laravel query where and
Table::where('Column', Value)->where('NewColumn', Value)->get();
Example 3: laravel find query
php artisan make:model Flight --migration
php artisan make:model Flight -m
Example 4: laravel find query
$model = App\Models\Flight::where('legs', '>', 100)
->firstOr(['id', 'legs'], function () {
});