Laravel::: Important Link List
Laravel — Create nice invoices with DomPDF (template!) 1) https://medium.com/@dennissmink/laravel-create-nice-invoices-with-dompdf-template-1a29c0ecd973 10+ Laravel Packages For Building Laravel Apps https://laravel-bap.com/10-plus-laravel-packages-for-building-laravel-apps/
Part one Data insert process
Working step::
1)
edit users schema file::
$table->increments('id');
$table->integer('role_id');
$table->string('name');
$table->string('username')->unique();
$table->string('email')->unique();
$table->string('phone')->unique();
$table->string('designation');
$table->string('password');
$table->string('image')->default('public/avatar/avatar.png');
$table->rememberToken();
$table->timestamps();
===============================
2)
create (role) model::
php artisan make:model Role -m
===============================
3) Go to role schema
write schema model ::
$table->increments('id');
$table->string('user_role');
$table->timestamps();
===============================
4) Go to User Model
create relationship in User model with role::
public function role(){
return $this->belongsTo('App\Role');
}
===============================
5)Go to Role Model
create relationship in role model with User::
public function users(){
return $this->hasMany('App\User');
}
===============================
6)
Create seeder(UserTableSeeder)::
php artisan make:seeder UsersTableSeeder
===============================
7)
Create seeder(UserTableSeeder)::
php artisan make:seeder RolesTableSeeder
===============================
8)
Register both seeder in DatabaseSeeder(UserTableSeeder and RolesTableSeeder)::
$this->call(UsersTableSeeder::class);
$this->call(RolesTableSeeder::class);
===============================
8)
Role insert in RolesTableSeeder)::
DB::table('roles')->insert([
'user_role'=>'Super admin'
]);
DB::table('roles')->insert([
'user_role'=>'Admin'
]);
DB::table('roles')->insert([
'user_role'=>'Editor'
]);
DB::table('roles')->insert([
'user_role'=>'Author'
]);
[N.B use Illuminate\Support\Facades\DB; ]
===============================
8)
User insert in UsersTableSeeder)::
DB::table('users')->insert([
'role_id'=>'1',
'name'=>'superadmin',
'username'=>'User01',
'email'=>'superadmin@gmail.com',
'phone'=>'+8801877100001',
'designation'=>'CEO',
'password'=>bcrypt('superadmin123'),
]);
DB::table('users')->insert([
'role_id'=>'2',
'name'=>'Admin',
'username'=>'User02',
'email'=>'admin@gmail.com.com',
'phone'=>'+8801877100002',
'designation'=>'HR',
'password'=>bcrypt('admin123'),
]);
DB::table('users')->insert([
'role_id'=>'3',
'name'=>'Editor',
'username'=>'User03',
'email'=>'editor@gmail.com',
'phone'=>'+8801877100003',
'designation'=>'GM',
'password'=>bcrypt('editor123'),
]);
DB::table('users')->insert([
'role_id'=>'4',
'name'=>'Author',
'username'=>'User04',
'email'=>'author@gmail.com',
'phone'=>'+8801877100004',
'designation'=>'H.W',
'password'=>bcrypt('author123'),
]);
[N.B use Illuminate\Support\Facades\DB; ]
10) Now get cmd and input this command
---- php artisan make:auth
---- php artisan migrate
---- php artisan db:seed
মন্তব্যসমূহ