larave Soft Deletes
Schema::table('flights', function (Blueprint $table) {
$table->softDeletes();
});
larave Soft Deletes
Schema::table('flights', function (Blueprint $table) {
$table->softDeletes();
});
laravel make model
php artisan make:model Flight --factory
php artisan make:model Flight -f
php artisan make:model Flight --seed
php artisan make:model Flight -s
php artisan make:model Flight --controller
php artisan make:model Flight -c
php artisan make:model Flight -mfsc
laravel update
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();
laravel find query
foreach (Flight::where('foo', 'bar')->cursor() as $flight) {
//
}
model laravel
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* The "booted" method of the model.
*
* @return void
*/
protected static function booted()
{
static::addGlobalScope('age', function (Builder $builder) {
$builder->where('age', '>', 200);
});
}
}
laravel model
use App\Models\Flight;
Flight::chunk(200, function ($flights) {
foreach ($flights as $flight) {
//
}
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us