laravel премахва, където
DB::table('users')->where('id', $id)->delete();
laravel създава модел
# The easiest way to create a model instance is using the
# make:model Artisan command:
php artisan make:model Flight
# If you would like to generate a database migration when you
# generate the model, you may use the --migration or -m option:
php artisan make:model Flight --migration
php artisan make:model Flight -m
laravel красноречив получите първата
// return first row by id
$user = App\User::where('id',$id)->first();
// or return directly a field
$userId = App\User::where(...)->pluck('id');
модел laravel::запитване
// Eloquent's Model::query() returns the query builder
Model::where()->get();
// Is the same as
Model::query()->where()->get();
Model::query();
// Can be useful to add query conditions based on certain requirements
// See https://stackoverflow.com/questions/51517203/what-is-the-meaning-of-eloquents-modelquery
област на приложение laravel
public function apply(Builder $builder, Model $model)
{
$builder->where('age', '>', 200);
}