create loantype seeder
This commit is contained in:
@@ -7,10 +7,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan;
|
||||
|
||||
use App\Models\Order\Loan\LoanType as LoanTypeModel;
|
||||
use App\Nova\Resource;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
@@ -9,7 +10,6 @@ use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||
use \App\Models\Order\Loan\LoanType as LoanTypeModel;
|
||||
|
||||
class LoanType extends Resource
|
||||
{
|
||||
@@ -38,9 +38,6 @@ class LoanType extends Resource
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
@@ -67,9 +64,6 @@ class LoanType extends Resource
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function cards(NovaRequest $request): array
|
||||
{
|
||||
@@ -78,9 +72,6 @@ class LoanType extends Resource
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function filters(NovaRequest $request): array
|
||||
{
|
||||
@@ -89,9 +80,6 @@ class LoanType extends Resource
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(NovaRequest $request): array
|
||||
{
|
||||
@@ -100,9 +88,6 @@ class LoanType extends Resource
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function actions(NovaRequest $request): array
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ return [
|
||||
*/
|
||||
|
||||
'brand' => [
|
||||
// 'logo' => resource_path('/img/example-logo.svg'),
|
||||
'logo' => public_path('/assets/images/logo.svg'),
|
||||
|
||||
'colors' => [
|
||||
'400' => '24, 182, 155, 0.5',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\Branch\Branch;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BranchTableSeeder extends Seeder
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -14,50 +12,8 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->createRoles();
|
||||
$this->createAdmins();
|
||||
}
|
||||
|
||||
public function createRoles(): void
|
||||
{
|
||||
if (Role::count() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$roles = [
|
||||
'king',
|
||||
'superadmin',
|
||||
'admin',
|
||||
'operator',
|
||||
'user',
|
||||
];
|
||||
|
||||
foreach ($roles as $role) {
|
||||
Role::create(['name' => $role]);
|
||||
}
|
||||
}
|
||||
|
||||
public function createAdmins(): void
|
||||
{
|
||||
$admins = [
|
||||
[
|
||||
'name' => 'Nurmuhammet Allanov',
|
||||
'email' => 'nurmuhammet@mail.com',
|
||||
'password' => '$2y$10$O7LFNdFIT3Rmfeo8tUfbqekB0x0incovkRP6eQuzvb7dVXysQyyBC',
|
||||
], [
|
||||
'name' => 'Mahmyt Allaberdiyev',
|
||||
'email' => 'mahmyt1206@gmail.com',
|
||||
'password' => '$2y$10$O7LFNdFIT3Rmfeo8tUfbqekB0x0incovkRP6eQuzvb7dVXysQyyBC',
|
||||
], [
|
||||
'name' => 'Döwran Myratlyýew',
|
||||
'email' => 'dovran.m@mail.ru',
|
||||
'password' => '$2y$10$EFQaBb.aM2KJRGGtuhjdM.3m4Mtm/vw68NjU2280d2RICDGI.o336',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
$user = User::create($admin);
|
||||
$user->assignRole('superadmin');
|
||||
}
|
||||
$this->call([BranchTableSeeder::class]);
|
||||
$this->call([UsersTableSeeder::class]);
|
||||
$this->call([LoanTypeSeeder::class]);
|
||||
}
|
||||
}
|
||||
|
||||
68
database/seeders/LoanTypeSeeder.php
Normal file
68
database/seeders/LoanTypeSeeder.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Order\Loan\LoanType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LoanTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$datas = [
|
||||
[
|
||||
'name' => [
|
||||
'tk' => 'Ýaş çatynjalara',
|
||||
'ru' => 'Кредит “Молодожёнам”',
|
||||
],
|
||||
'tax' => 1,
|
||||
'maturity' => 30,
|
||||
'notes' => '',
|
||||
'active' => true,
|
||||
], [
|
||||
'name' => [
|
||||
'tk' => 'Üpjünçiligine zamunlyk bolan sarp ediş karzy',
|
||||
'ru' => 'Потребительский кредит под поручительство',
|
||||
],
|
||||
'tax' => 1,
|
||||
'maturity' => 30,
|
||||
'notes' => '',
|
||||
'active' => true,
|
||||
], [
|
||||
'name' => [
|
||||
'tk' => 'Kiçi göwrümli karzlar',
|
||||
'ru' => 'Микро кредиты',
|
||||
],
|
||||
'tax' => 1,
|
||||
'maturity' => 30,
|
||||
'notes' => '',
|
||||
'active' => true,
|
||||
], [
|
||||
'name' => [
|
||||
'tk' => 'Üpjünçiligine girew emlägi bolan sarp ediş karzy',
|
||||
'ru' => 'Потребительский кредит под залог имущества',
|
||||
],
|
||||
'tax' => 1,
|
||||
'maturity' => 30,
|
||||
'notes' => '',
|
||||
'active' => true,
|
||||
], [
|
||||
'name' => [
|
||||
'tk' => 'Talyp karzy',
|
||||
'ru' => 'Кредит “Студенческий”',
|
||||
],
|
||||
'tax' => 1,
|
||||
'maturity' => 30,
|
||||
'notes' => '',
|
||||
'active' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($datas as $data) {
|
||||
LoanType::create($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
database/seeders/UsersTableSeeder.php
Normal file
62
database/seeders/UsersTableSeeder.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\System\Roles\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UsersTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->createRoles();
|
||||
$this->createAdmins();
|
||||
}
|
||||
|
||||
public function createRoles(): void
|
||||
{
|
||||
if (Role::count() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$roles = [
|
||||
'king',
|
||||
'superadmin',
|
||||
'admin',
|
||||
'operator',
|
||||
'user',
|
||||
];
|
||||
|
||||
foreach ($roles as $role) {
|
||||
Role::create(['name' => $role]);
|
||||
}
|
||||
}
|
||||
|
||||
public function createAdmins(): void
|
||||
{
|
||||
$admins = [
|
||||
[
|
||||
'name' => 'Nurmuhammet Allanov',
|
||||
'email' => 'nurmuhammet@mail.com',
|
||||
'password' => '$2y$10$O7LFNdFIT3Rmfeo8tUfbqekB0x0incovkRP6eQuzvb7dVXysQyyBC',
|
||||
], [
|
||||
'name' => 'Mahmyt Allaberdiyev',
|
||||
'email' => 'mahmyt1206@gmail.com',
|
||||
'password' => '$2y$10$O7LFNdFIT3Rmfeo8tUfbqekB0x0incovkRP6eQuzvb7dVXysQyyBC',
|
||||
], [
|
||||
'name' => 'Döwran Myratlyýew',
|
||||
'email' => 'dovran.m@mail.ru',
|
||||
'password' => '$2y$10$EFQaBb.aM2KJRGGtuhjdM.3m4Mtm/vw68NjU2280d2RICDGI.o336',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
$user = User::create($admin);
|
||||
$user->assignRole('superadmin');
|
||||
}
|
||||
}
|
||||
}
|
||||
3017
public/assets/images/logo.svg
Normal file
3017
public/assets/images/logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 979 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 5.0 KiB |
Reference in New Issue
Block a user