database seeder
#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder<?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 db:seed --class=UserSeederphp artisan make:seeder NameOfTheSeederphp artisan make:seeder UserSeederuse App\Models\User;
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
User::factory()
->times(50)
->hasPosts(1)
->create();
}
Also in PHP:
- count characters string php
- config cache clear laravel
- exclude php
- date F month php
- creating thumbnail in codeigniter
- 20210329 to date format php
- doctrine order by
- echo in json format php
- date method in php
- change datetime format from Y-m-d h:i:s to d-m-Y in php
- @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
- date and time function php
- check if current page is home url wordpress
- datatype checking in php
- cron.php
- exception php
- display date and hour php
- PHP STRING LENGT
- check if string has a string php
- array_count_values php
- fetch data based on month and year in laravel
- clear all cache in laravel 7
- creating laravel project
- find string exist in string php