forked from aslan/applicant-site
add seeders
This commit is contained in:
parent
1491d8b425
commit
287c0eac76
2
Makefile
2
Makefile
|
@ -20,7 +20,7 @@ setup-test:
|
||||||
php artisan key:gen --ansi
|
php artisan key:gen --ansi
|
||||||
rm database/database.sqlite
|
rm database/database.sqlite
|
||||||
touch database/database.sqlite
|
touch database/database.sqlite
|
||||||
php artisan migrate
|
php artisan migrate:refresh
|
||||||
php artisan db:seed
|
php artisan db:seed
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use App\Models\Faculty;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
@ -22,7 +23,10 @@ class DatabaseSeeder extends Seeder
|
||||||
]);
|
]);
|
||||||
$this->call([
|
$this->call([
|
||||||
ReceptionScreenSeeder::class,
|
ReceptionScreenSeeder::class,
|
||||||
FileSeeder::class
|
FileSeeder::class,
|
||||||
|
EducationalInstitutionSeeder::class,
|
||||||
|
FacultySeeder::class,
|
||||||
|
DepartmentSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Department;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
class DepartmentSeeder extends Seeder
|
class DepartmentSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
@ -12,6 +15,19 @@ class DepartmentSeeder extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
DB::table('departments')->insert([
|
||||||
|
[
|
||||||
|
'name' => 'Кафедра инф. без.',
|
||||||
|
'description' => 'Кафедра инф. без. описание',
|
||||||
|
'position' => 1,
|
||||||
|
'faculty_id' => 1,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'кафедра стоматологии',
|
||||||
|
'description' => 'кафедра стоматологии описание',
|
||||||
|
'position' => 2,
|
||||||
|
'faculty_id' => 2,
|
||||||
|
],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\EducationalInstitution;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class EducationalInstitutionSeeder extends Seeder
|
class EducationalInstitutionSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
@ -12,6 +14,17 @@ class EducationalInstitutionSeeder extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
DB::table('educational_institutions')->insert([
|
||||||
|
[
|
||||||
|
'name' => 'МГТУ',
|
||||||
|
'description' => 'ФГБОУ ВО Майкопский государственный технологический университет',
|
||||||
|
'position' => 1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Педколледж',
|
||||||
|
'description' => 'ФГБОУ СПО Педагогический колледж',
|
||||||
|
'position' => 1
|
||||||
|
],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Faculty;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class FacultySeeder extends Seeder
|
class FacultySeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
@ -12,6 +14,19 @@ class FacultySeeder extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
DB::table('faculties')->insert([
|
||||||
|
[
|
||||||
|
'name' => 'Информационная безопасность',
|
||||||
|
'description' => 'Факультет информационной безопасности описание',
|
||||||
|
'position' => 1,
|
||||||
|
'educational_institution_id' => 1,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Лечебный факультет',
|
||||||
|
'description' => 'Факультет Лечебный описание',
|
||||||
|
'position' => 1,
|
||||||
|
'educational_institution_id' => 2,
|
||||||
|
],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue