Créer un modèle dans la ligne de commande Laravel
# Create a new Drink model.
php artisan make:model Drink
Lonely Lion
# Create a new Drink model.
php artisan make:model Drink
// Model Naming Convention: singular, ProperCase EG: User, UserRequest
php artisan make:model Flight -f // with Factory
php artisan make:model Flight -s // with Seeder
php artisan make:model Flight -c // with Controller
php artisan make:model Flight -m // with Migration
// EG: use any flag combo to create Model with Migration, Factory, Seeder and Controller
php artisan make:model Flight -mfsc
php artisan make:model Flight
$user = User::create([
'first_name' => 'Taylor',
'last_name' => 'Otwell',
'title' => 'Developer',
]);
$user->title = 'Painter';
$user->isDirty(); // true
$user->isDirty('title'); // true
$user->isDirty('first_name'); // false
$user->isClean(); // false
$user->isClean('title'); // false
$user->isClean('first_name'); // true
$user->save();
$user->isDirty(); // false
$user->isClean(); // true
php artisan make:model example
$userData = array('username' => 'Me', 'email' => '[email protected]');
User::create($userData);