create seed laravel
#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$this->call([
UserSeeder::class,
PostSeeder::class,
CommentSeeder::class,
]);
}<?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'),
]);
}
}php artisan make:seeder UserSeederphp artisan make:seeder NameOfTheSeeder
Also in PHP:
- PHP debug console print
- adding days in date, php
- count string char php
- check substring in php
- check key exists in associative array in php
- date format php l with capital
- custom post type with taxonomy
- DATE fromat H:i j M Y
- Redirection page php
- changing php version in composer in server
- error reporting all php
- file_get_contents(): SSL: The operation completed successfully but file_get_contents(http://www.b2bsoftwareking.com): failed to open stream: No connection could be made because the target machine actively refused it. in
- display error message in php
- check type of php
- extend maximum execution tim e
- don't show php errors
- does php use integer divison
- array_column in php
- confirm password validation in laravel
- cache issue laravel
- codeigniter delete record by id
- convert base64 to image php
- add brackets to string php
- check if someone right click javascript