“Samendatum Laravel” Code-Antworten

Laravel Run Samen

#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder
Eranot

Samendatum Laravel

use Carbon\Carbon;

Setting::create([
    'name' => 'Start Date',
    'date' => Carbon::parse('2000-01-01')
]);
NachooCh

Laravel Seed Timestemps Säulen

DB::table('menu_types')->insert([ 'title' => 'Footer', 'description' => str_random(10), 'created_at' => date("Y-m-d H:i:s") ]);


---------------------

Auto timestamp saving is only for Eloquent feature so you need to do manually like below for non eloquent feature

DB::table('languages')->insert([
    'name'        => 'English',
    'flag'        => '',
    'abbr'        => 'en',
    'script'    => 'Latn',
    'native'    => 'English',
    'active'    => '1',
    'default'    => '1',
    'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
    'updated_at' => Carbon::now()->format('Y-m-d H:i:s')

]);
OR do it eloquently(Like you have seen in auto generated seeds like UserTableSeeder)

    $language = new Language();
    $language ->name = 'English';
    $language->flag'  = '',
    $language ->abbr  = 'en',
    $language->script ='Latn',
    $language->native ='English',
    $language->active ='1',
    $language->default ='1',
    $language->save();
Valentino_Rossi

Ähnliche Antworten wie “Samendatum Laravel”

Fragen ähnlich wie “Samendatum Laravel”

Weitere verwandte Antworten zu “Samendatum Laravel” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen