ahcanor
6/20/2016 - 9:16 PM

Laravel: Create, Insert, Save

Laravel: Create, Insert, Save

<?php


// INSERT
DB::table('users')->insert(['email' => 'john@example.com', 'votes' => 0]);

// INSERT MULTIPLE
DB::table('users')->insert([
    ['email' => 'taylor@example.com', 'votes' => 0],
    ['email' => 'dayle@example.com', 'votes' => 0]
]);

// SAVE (updated_at, created_at autom√°ticos)
$flight = new Flight;
$flight->name = $request->name;
$flight->save();

// CREATE
$flight = App\Flight::create(['name' => 'Flight 10']);



?>