call seeder laravel
#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeederuse App\Models\User;
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
User::factory()
->times(50)
->hasPosts(1)
->create();
}<?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:
- create 5 rendom charactors in php
- db seed in controller
- email configuration for gmail in laravel
- "codeigniter 4" cart
- check if astring is apart of another string in php
- fetch time in php
- cache store laravel
- check divisibility by 2 in php
- base64 decode encode php
- clear cache in php artisan
- character length in php
- disable errors in php
- check if string contains a symbol php
- check id the division is not giving rest php
- create a folder with php
- axios post php
- datetime manual date format
- buat table seeder laravel
- check if contains 1 in string php
- check if array is duplicate and get the latest values php
- check if array__key exists
- cusatom time format to timestamp php
- centos php log
- create laravel 6 project