“Laravel Delete” Respostas de código

Laravel Delete

DB::table('users')->where('votes', '>', 100)->delete();
unmeego

Como criar modelo em Laravel

php artisan make:model Flight

Delete eloqüente Laravel

use App\Models\Flight;

$flight = Flight::find(1);

$flight->delete();
Cooperative Crab

Laravel Crie ou atualize

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Models\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
Embarrassed Eel

Larave Soft Excluir

Schema::table('flights', function (Blueprint $table) {
    $table->softDeletes();
});
Alberto Peripolli

Laravel Delete

Flight::destroy(1);

Flight::destroy(1, 2, 3);

Flight::destroy([1, 2, 3]);

Flight::destroy(collect([1, 2, 3]));
Magnificent Mink

Respostas semelhantes a “Laravel Delete”

Procure respostas de código populares por idioma

Procurar outros idiomas de código