creating seeder laravel
#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder<?php
namespace Database\Seeders;
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 seeders.
*
* @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 migrate:fresh --seedphp artisan db:seed --class=UserSeeder
Also in PHP:
- Title
- creating seeder laravel
- Category
- PHP
- Title
- clear server cache laravel
- Category
- PHP
- Title
- advanaced layout builder enfold custom post type
- Category
- PHP
- Title
- find string into string
- Category
- PHP
- Title
- Illuminate\Contracts\Container\BindingResolutionException Target class [HomeController] does not exist.
- Category
- PHP
- Title
- Fixes duplicate arrays to show a single character. php
- Category
- PHP
- Title
- Class 'App\Http\Controllers\Admin\Route' not found
- Category
- PHP
- Title
- $_redirect() php
- Category
- PHP
- Title
- CONVERT STRING TO DECIMAL php
- Category
- PHP
- Title
- create an email addresses php
- Category
- PHP
- Title
- display_errors in php.ini
- Category
- PHP
- Title
- create new authentication middleware laravel
- Category
- PHP
- Title
- disallow search engines
- Category
- PHP
- Title
- date('F')
- Category
- PHP
- Title
- How I can disable update at in eloquent
- Category
- PHP
- Title
- Variable "$id" is not defined by operation "GetPost".
- Category
- PHP
- Title
- core php mail function without phpmailer
- Category
- PHP
- Title
- TRANSACTON LARAVEL QUERY BUILDER
- Category
- PHP
- Title
- eloquent disable updated_at
- Category
- PHP
- Title
- data:image/png;base64 php
- Category
- PHP
- Title
- command laravel for php artisan make :auth
- Category
- PHP
- Title
- CODE PPHP
- Category
- PHP
- Title
- 150 charachter display only php
- Category
- PHP
- Title
- enable error reporting on a page php
- Category
- PHP