%PDF- %PDF-
Direktori : /var/www/html/shaban/duassis/api/database/seeds/ |
Current File : //var/www/html/shaban/duassis/api/database/seeds/ClientsTableSeeder.php |
<?php use App\Exceptions\AppException; use App\Models\Category; use App\Models\Field; use App\Models\Role; use App\Models\User; use Illuminate\Database\Seeder; class ClientsTableSeeder extends Seeder { /** * Run the database seeds. * * @return void * @throws AppException */ public function run() { $role = Role::query() ->where('name', Role::CLIENT) ->first(); /** @var Category $football */ $football = Category::query() ->where('slug', 'football') ->first(); /** @var Category $basket */ $basket = Category::query() ->where('slug', 'basketball') ->first(); /** @var Category $volley */ $volley = Category::query() ->where('slug', 'volley') ->first(); /** @var Category $tennis */ $tennis = Category::query() ->where('slug', 'tennis') ->first(); /** @var User $fari */ $fari = User::query() ->create([ 'display_name' => 'Kompleksi Fari', 'password' => 'password', 'email' => 'fari@duassis.com', ]); $fari->roles() ->attach($role); $fari->profile() ->updateOrInsert(['user_id' => $fari->id], [ 'phone' => '+355692517964', 'birthday' => null, ]); $fari->address() ->updateOrInsert([ 'model_id' => $fari->id, 'model_type' => 'User', ], [ 'street' => 'Street', 'latitude' => '41.3080396', 'longitude' => '19.8140852', 'city' => 'Tirane', ]); Field::createItem([ 'name' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'description' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'capacity' => 12, 'user_id' => $fari->id, 'categoriesId' => [$football->id], ]); Field::createItem([ 'name' => [ 'en' => 'Football field', 'it' => 'Campo da calcio', 'sq' => 'Fushe futbolli', ], 'description' => [ 'en' => 'Fusha madhe 9v9.', 'it' => 'Fusha madhe 9v9.', 'sq' => 'Fusha madhe 9v9.', ], 'capacity' => 18, 'user_id' => $fari->id, 'categoriesId' => [$football->id], ]); /** @var User $peti */ $peti = User::query() ->create([ 'display_name' => 'Peti', 'password' => 'password', 'email' => 'peti@duassis.com', ]); $peti->roles() ->attach($role); $peti->profile() ->updateOrInsert(['user_id' => $peti->id], [ 'phone' => '+355682149147', 'birthday' => null, ]); $peti->address() ->updateOrInsert([ 'model_id' => $peti->id, 'model_type' => 'User', ], [ 'street' => 'Street', 'latitude' => '41.3063763', 'longitude' => '19.8163439', 'city' => 'Tirane', ]); Field::createItem([ 'name' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'description' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'capacity' => 12, 'user_id' => $peti->id, 'categoriesId' => [$football->id], ]); /** @var User $nsp */ $nsp = User::query() ->create([ 'display_name' => 'National Sport Park', 'password' => 'password', 'email' => 'nsp@duassis.com', ]); $nsp->roles() ->attach($role); $nsp->profile() ->updateOrInsert(['user_id' => $nsp->id], [ 'phone' => '+355682095590', 'birthday' => null, ]); $nsp->address() ->updateOrInsert([ 'model_id' => $nsp->id, 'model_type' => 'User', ], [ 'street' => 'Rruga Siri Kodra, Tirana 1000', 'latitude' => '41.3495754', 'longitude' => '19.8099589', 'city' => 'Tirane', ]); Field::createItem([ 'name' => [ 'en' => 'Tennis fields', 'it' => 'Campi da tennis', 'sq' => 'Fusha tenisi', ], 'description' => [ 'en' => 'Seven tennis fields', 'it' => 'Sette campi da tennis', 'sq' => 'Shtate fusha tenisi', ], 'capacity' => 4, 'user_id' => $nsp->id, 'categoriesId' => [$tennis->id], ]); Field::createItem([ 'name' => [ 'en' => 'Jumpy fields', 'it' => 'Jumpy fields', 'sq' => 'Jumpy fields', ], 'description' => [ 'en' => 'Two fields where you can play either volleyball or basketball.', 'it' => 'Two fields where you can play either volleyball or basketball.', 'sq' => 'Two fields where you can play either volleyball or basketball.', ], 'capacity' => 12, 'user_id' => $nsp->id, 'categoriesId' => [$basket->id, $volley->id], ]); Field::createItem([ 'name' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'description' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'capacity' => 12, 'user_id' => $nsp->id, 'categoriesId' => [$football->id], ]); /** @var User $liqeni */ $liqeni = User::query() ->create([ 'display_name' => 'Kompleksi Aquadrom Tirana', 'password' => 'password', 'email' => 'liqeni@duassis.com', ]); $liqeni->roles() ->attach($role); $liqeni->profile() ->updateOrInsert(['user_id' => $liqeni->id], [ 'phone' => '+35542465521', 'birthday' => null, ]); $liqeni->address() ->updateOrInsert([ 'model_id' => $liqeni->id, 'model_type' => 'User', ], [ 'street' => 'Rruga Anton Ashta, Tiranë 1001', 'latitude' => '41.3122224', 'longitude' => '19.8118205', 'city' => 'Tirane', ]); Field::createItem([ 'name' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'description' => [ 'en' => 'Football field', 'it' => 'Campo da calcetto', 'sq' => 'Fushe kalceto', ], 'capacity' => 12, 'user_id' => $liqeni->id, 'categoriesId' => [$football->id], ]); } }