add seeders

This commit is contained in:
aslan 2024-02-08 16:20:05 +03:00
parent 1491d8b425
commit 287c0eac76
5 changed files with 53 additions and 5 deletions

View File

@ -20,7 +20,7 @@ setup-test:
php artisan key:gen --ansi
rm database/database.sqlite
touch database/database.sqlite
php artisan migrate
php artisan migrate:refresh
php artisan db:seed
npm ci
npm run build

View File

@ -3,6 +3,7 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Faculty;
use App\Models\User;
use Illuminate\Database\Seeder;
@ -22,7 +23,10 @@ class DatabaseSeeder extends Seeder
]);
$this->call([
ReceptionScreenSeeder::class,
FileSeeder::class
FileSeeder::class,
EducationalInstitutionSeeder::class,
FacultySeeder::class,
DepartmentSeeder::class,
]);
}
}

View File

@ -2,8 +2,11 @@
namespace Database\Seeders;
use App\Models\Department;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DepartmentSeeder extends Seeder
{
@ -12,6 +15,19 @@ class DepartmentSeeder extends Seeder
*/
public function run(): void
{
//
DB::table('departments')->insert([
[
'name' => 'Кафедра инф. без.',
'description' => 'Кафедра инф. без. описание',
'position' => 1,
'faculty_id' => 1,
],
[
'name' => 'кафедра стоматологии',
'description' => 'кафедра стоматологии описание',
'position' => 2,
'faculty_id' => 2,
],
]);
}
}

View File

@ -2,8 +2,10 @@
namespace Database\Seeders;
use App\Models\EducationalInstitution;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EducationalInstitutionSeeder extends Seeder
{
@ -12,6 +14,17 @@ class EducationalInstitutionSeeder extends Seeder
*/
public function run(): void
{
//
DB::table('educational_institutions')->insert([
[
'name' => 'МГТУ',
'description' => 'ФГБОУ ВО Майкопский государственный технологический университет',
'position' => 1
],
[
'name' => 'Педколледж',
'description' => 'ФГБОУ СПО Педагогический колледж',
'position' => 1
],
]);
}
}

View File

@ -2,8 +2,10 @@
namespace Database\Seeders;
use App\Models\Faculty;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class FacultySeeder extends Seeder
{
@ -12,6 +14,19 @@ class FacultySeeder extends Seeder
*/
public function run(): void
{
//
DB::table('faculties')->insert([
[
'name' => 'Информационная безопасность',
'description' => 'Факультет информационной безопасности описание',
'position' => 1,
'educational_institution_id' => 1,
],
[
'name' => 'Лечебный факультет',
'description' => 'Факультет Лечебный описание',
'position' => 1,
'educational_institution_id' => 2,
],
]);
}
}