laravel force model update code example
Example 1: laravel force delete
Product::find($id)->forceDelete();
Example 2: laravel soft delete
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->softDeletes();
});
}
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model {
use SoftDeletes;
protected $dates = ['deleted_at'];
}
Example 3: php artisan make model
php artisan make:model Flight
Example 4: laravel force delete
Product::onlyTrashed()->where('deleted_at', '<', Carbon::subDays(30))->forceDelete();