create a database seeder function
php artisan make:model MODEL_PATH\MODEL_NAME -ms
-m, --migration Create a new migration file for the model.
-s, --seeder Create a new seeder file for the model.<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->insert([
'name' => Str::random(10),
'email' => Str::random(10).'@gmail.com',
'password' => Hash::make('password'),
]);
}
}
Also in PHP:
- array key value php
- check substring php
- Main features of php
- Impossible de trouver le paquet php-gettext
- codeigniter where_not_in
- create new laravel project 8
- check format have image laravel
- calculate total time from start and end datetime in php
- Fixes duplicate arrays to show a single character. php
- error log display
- check value in array key php
- composer global require laravel/installer version 5.61
- check if php string contains
- combox with auto filter, auto search cakephp
- artisan composer install
- current date in codeigniter
- Reading a Tree of Files and Folders in php
- create an exception php
- buddypress author link
- dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/bin/php Reason: image not found zsh: abort bin/console sw:cache:clear
- add to hours to variable date php
- creating laravel website
- check existence of key in array
- eloquent update row response