Compare commits
20 Commits
feature/pa
...
feature/Ge
| Author | SHA1 | Date | |
|---|---|---|---|
| c08d8eaf3b | |||
| 675d2bdbad | |||
| 69ffe322ce | |||
| a1466d8f57 | |||
| 392fca8635 | |||
| 9a01a83370 | |||
| 8438655f8c | |||
| 5040299efc | |||
| 26a0f79a6d | |||
| 1b5d339a53 | |||
| c73d50d096 | |||
| 8be89d350f | |||
| d31c641216 | |||
| aa363d1695 | |||
| ca2ec66fb5 | |||
| 5c757e1823 | |||
| d9f895c382 | |||
| 9ad3d6cea0 | |||
| 8554f4cc55 | |||
| 5e48777e1c |
@@ -16,19 +16,6 @@ class AuthController extends Controller
|
|||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function register(RegisterRequest $request): JsonResponse
|
|
||||||
{
|
|
||||||
Expert::query()->create([
|
|
||||||
'username' => $request->username,
|
|
||||||
'email' => $request->email,
|
|
||||||
'password' => Hash::make($request->password),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$request->session()->regenerate();
|
|
||||||
|
|
||||||
return $this->successResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function login(LoginRequest $request): JsonResponse
|
public function login(LoginRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$credentials = ['password' => $request->password];
|
$credentials = ['password' => $request->password];
|
||||||
@@ -39,8 +26,7 @@ class AuthController extends Controller
|
|||||||
$credentials['username'] = $request->login;
|
$credentials['username'] = $request->login;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auth::attempt($credentials))
|
if (Auth::guard('expert')->attempt($credentials)) {
|
||||||
{
|
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ enum BusinessTypeEnum: int
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name($id): string
|
public static function name($id): string
|
||||||
{
|
{
|
||||||
$mapArray = [
|
$mapArray = [
|
||||||
1 => 'medical',
|
1 => 'medical',
|
||||||
|
|||||||
@@ -5,17 +5,19 @@ namespace App\Models;
|
|||||||
use Database\Factories\ExpertFactory;
|
use Database\Factories\ExpertFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method roles()
|
* @method roles()
|
||||||
* @method permissions()
|
* @method permissions()
|
||||||
*/
|
*/
|
||||||
class Expert extends Model
|
class Expert extends Authenticatable
|
||||||
{
|
{
|
||||||
/** @use HasFactory<ExpertFactory> */
|
/** @use HasFactory<ExpertFactory> */
|
||||||
use HasFactory;
|
|
||||||
use HasRoles;
|
use Notifiable,HasFactory,HasRoles;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
protected string $guard_name = 'web';
|
protected string $guard_name = 'web';
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Database\Factories\UserGatewayFactory;
|
use Database\Factories\UserGatewayFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class UserGateway extends Model
|
class UserGateway extends Model
|
||||||
{
|
{
|
||||||
@@ -12,4 +14,11 @@ class UserGateway extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
|
protected function logo(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
backend/app/User/Controllers/CityController.php
Executable file
24
backend/app/User/Controllers/CityController.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CityController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function list(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$cities = City::query()
|
||||||
|
->where('province_id', '=', $request->query('province_id'))
|
||||||
|
->get(['id', 'name']);
|
||||||
|
|
||||||
|
return $this->successResponse($cities);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ use Illuminate\Http\JsonResponse;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Laravel\Passport\ClientRepository;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
class GatewayManagementController extends Controller
|
class GatewayManagementController extends Controller
|
||||||
@@ -27,7 +28,7 @@ class GatewayManagementController extends Controller
|
|||||||
$request,
|
$request,
|
||||||
allowedFilters: ['*'],
|
allowedFilters: ['*'],
|
||||||
allowedSortings: ['*'],
|
allowedSortings: ['*'],
|
||||||
allowedSelects: ['id', 'name', 'domain', 'tax_id', 'bank_name', 'account_holder', 'iban', 'business_type_id', 'business_type_name'],
|
allowedSelects: ['*'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,9 +39,19 @@ class GatewayManagementController extends Controller
|
|||||||
{
|
{
|
||||||
$user = Auth::guard('web')->user();
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
$logo = $request->has('logo') ? FileFacade::save($request->file('logo'), "{$user->id}") : null;
|
$logo = $request->hasFile('logo')
|
||||||
|
? FileFacade::save($request->file('logo'), "user_gateway/{$user->id}")
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$passportClient = DB::transaction(function () use ($user, $logo, $request) {
|
||||||
|
|
||||||
|
$clientName = "Gateway {$request->name} - User {$user->id}";
|
||||||
|
$client = app(ClientRepository::class)->createPasswordGrantClient($clientName, 'users', true);
|
||||||
|
$client->Fill([
|
||||||
|
'owner_type' => get_class($user),
|
||||||
|
'owner_id' => $user->id,
|
||||||
|
])->save();
|
||||||
|
|
||||||
DB::transaction(function () use ($user, $logo, $request) {
|
|
||||||
UserGateway::query()->create([
|
UserGateway::query()->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
@@ -53,15 +64,20 @@ class GatewayManagementController extends Controller
|
|||||||
'business_type_id' => $request->business_type_id,
|
'business_type_id' => $request->business_type_id,
|
||||||
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
||||||
'logo' => $logo,
|
'logo' => $logo,
|
||||||
|
'client_id' => $client->id,
|
||||||
|
'client_secret' => $client->secret,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->update(['authority_level' => 1]);
|
$user->update(['authority_level' => 1]);
|
||||||
|
|
||||||
|
return $client;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return $this->successResponse([
|
||||||
return $this->successResponse();
|
'client_id' => $passportClient->id,
|
||||||
|
'client_secret' => $passportClient->secret,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(UserGateway $gateway): JsonResponse
|
public function show(UserGateway $gateway): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse($gateway);
|
return $this->successResponse($gateway);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class ProfileController extends Controller
|
|||||||
$user->update([
|
$user->update([
|
||||||
'first_name' => $request->first_name,
|
'first_name' => $request->first_name,
|
||||||
'last_name' => $request->last_name,
|
'last_name' => $request->last_name,
|
||||||
'national_id' => $request->national_id,
|
'national_id' => $user->kyc_status == 0 ? $request->national_id : $user->national_id,
|
||||||
'address' => $request->address,
|
'address' => $request->address,
|
||||||
'postal_code' => $request->postal_code,
|
'postal_code' => $request->postal_code,
|
||||||
'phone_number' => $request->phone_number,
|
'phone_number' => $request->phone_number,
|
||||||
|
|||||||
17
backend/app/User/Controllers/ProvinceController.php
Executable file
17
backend/app/User/Controllers/ProvinceController.php
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class ProvinceController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
public function list(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse(Province::all(['id', 'name']));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,8 +13,7 @@ class StoreRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return Auth::guard('web')->user()->kyc_status;
|
return true; }
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -24,12 +24,13 @@ class UserResource extends JsonResource
|
|||||||
'address' => $this->address,
|
'address' => $this->address,
|
||||||
'postal_code' => $this->postal_code,
|
'postal_code' => $this->postal_code,
|
||||||
'phone_number' => $this->phone_number,
|
'phone_number' => $this->phone_number,
|
||||||
'province_id' => $this->provonce_id,
|
'province_id' => $this->province_id,
|
||||||
'province_name' => $this->province_name,
|
'province_name' => $this->province_name,
|
||||||
'city_id' => $this->city_id,
|
'city_id' => $this->city_id,
|
||||||
'city_name' => $this->city_name,
|
'city_name' => $this->city_name,
|
||||||
'birth_date' => $this->birth_date,
|
'birth_date' => $this->birth_date,
|
||||||
'kyc_status' => $this->kyc_status,
|
'kyc_status' => $this->kyc_status,
|
||||||
|
'authority_level' => $this->authority_level,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Expert;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('user_gateways', function (Blueprint $table) {
|
||||||
|
$table->string('client_id')->nullable();
|
||||||
|
$table->string('client_secret')->nullable();
|
||||||
|
$table->integer('status')->default(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('user_gateways', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['client_id', 'client_secret','status']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
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 CitySeeder extends Seeder
|
class CitySeeder extends Seeder
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,125 @@ class CitySeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
DB::table('cities')->insert([
|
||||||
|
// Baghdad
|
||||||
|
['province_id' => 1, 'name' => 'Baghdad', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 1, 'name' => 'Sadr City', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 1, 'name' => 'Kadhimiya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 1, 'name' => 'Adhamiyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 1, 'name' => 'Abu Ghraib', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 1, 'name' => 'Mahmudiya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Basra
|
||||||
|
['province_id' => 2, 'name' => 'Basra', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 2, 'name' => 'Al-Zubair', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 2, 'name' => 'Umm Qasr', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 2, 'name' => 'Al-Qurnah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 2, 'name' => 'Shatt Al-Arab', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 2, 'name' => 'Abu Al-Khaseeb', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Nineveh
|
||||||
|
['province_id' => 3, 'name' => 'Mosul', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 3, 'name' => 'Tal Afar', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 3, 'name' => 'Sinjar', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 3, 'name' => 'Al-Hamdaniya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 3, 'name' => 'Bashiqa', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 3, 'name' => 'Qayyarah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Erbil
|
||||||
|
['province_id' => 4, 'name' => 'Erbil', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 4, 'name' => 'Shaqlawa', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 4, 'name' => 'Soran', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 4, 'name' => 'Koya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 4, 'name' => 'Makhmur', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Sulaymaniyah
|
||||||
|
['province_id' => 5, 'name' => 'Sulaymaniyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 5, 'name' => 'Halabja', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 5, 'name' => 'Ranya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 5, 'name' => 'Kalar', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 5, 'name' => 'Chamchamal', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Duhok
|
||||||
|
['province_id' => 6, 'name' => 'Duhok', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 6, 'name' => 'Zakho', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 6, 'name' => 'Amedi', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 6, 'name' => 'Akre', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 6, 'name' => 'Semel', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Kirkuk
|
||||||
|
['province_id' => 7, 'name' => 'Kirkuk', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 7, 'name' => 'Hawija', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 7, 'name' => 'Dibis', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 7, 'name' => 'Daquq', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Diyala
|
||||||
|
['province_id' => 8, 'name' => 'Baqubah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 8, 'name' => 'Khanaqin', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 8, 'name' => 'Muqdadiyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 8, 'name' => 'Balad Ruz', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 8, 'name' => 'Jalawla', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Anbar
|
||||||
|
['province_id' => 9, 'name' => 'Ramadi', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 9, 'name' => 'Fallujah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 9, 'name' => 'Haditha', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 9, 'name' => 'Hit', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 9, 'name' => 'Al-Qaim', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 9, 'name' => 'Rutba', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Salah al-Din
|
||||||
|
['province_id' => 10, 'name' => 'Tikrit', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 10, 'name' => 'Samarra', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 10, 'name' => 'Balad', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 10, 'name' => 'Baiji', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 10, 'name' => 'Tuz Khurmatu', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Karbala
|
||||||
|
['province_id' => 11, 'name' => 'Karbala', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 11, 'name' => 'Al-Hindiya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 11, 'name' => 'Ain Al-Tamur', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Najaf
|
||||||
|
['province_id' => 12, 'name' => 'Najaf', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 12, 'name' => 'Kufa', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 12, 'name' => 'Al-Manathera', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Babil
|
||||||
|
['province_id' => 13, 'name' => 'Hillah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 13, 'name' => 'Al-Mahawil', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 13, 'name' => 'Al-Musayyib', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 13, 'name' => 'Hashimiya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Wasit
|
||||||
|
['province_id' => 14, 'name' => 'Kut', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 14, 'name' => 'Al-Hayy', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 14, 'name' => 'Al-Numaniyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 14, 'name' => 'Badra', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Maysan
|
||||||
|
['province_id' => 15, 'name' => 'Amarah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 15, 'name' => 'Ali Al-Sharqi', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 15, 'name' => 'Al-Majarr Al-Kabir', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 15, 'name' => 'Qalat Saleh', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Dhi Qar
|
||||||
|
['province_id' => 16, 'name' => 'Nasiriyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 16, 'name' => 'Al-Shatrah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 16, 'name' => 'Suq Al-Shuyukh', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 16, 'name' => 'Rifai', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Muthanna
|
||||||
|
['province_id' => 17, 'name' => 'Samawah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 17, 'name' => 'Rumaitha', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 17, 'name' => 'Al-Khidhir', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 17, 'name' => 'Salman', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
|
||||||
|
// Al-Qadisiyyah
|
||||||
|
['province_id' => 18, 'name' => 'Diwaniyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 18, 'name' => 'Afak', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 18, 'name' => 'Al-Shamiya', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['province_id' => 18, 'name' => 'Hamza', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,9 @@ class DatabaseSeeder extends Seeder
|
|||||||
'email' => 'test@example.com',
|
'email' => 'test@example.com',
|
||||||
'password' => 'password123@',
|
'password' => 'password123@',
|
||||||
]);
|
]);
|
||||||
|
$this->call([
|
||||||
|
ProvinceSeeder::class,
|
||||||
|
CitySeeder::class,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
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 ProvinceSeeder extends Seeder
|
class ProvinceSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,25 @@ class ProvinceSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
//
|
DB::table('provinces')->insert([
|
||||||
|
['id' => 1, 'name' => 'Baghdad', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 2, 'name' => 'Basra', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 3, 'name' => 'Nineveh', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 4, 'name' => 'Erbil', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 5, 'name' => 'Sulaymaniyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 6, 'name' => 'Duhok', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 7, 'name' => 'Kirkuk', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 8, 'name' => 'Diyala', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 9, 'name' => 'Anbar', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 10, 'name' => 'Salah al-Din', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 11, 'name' => 'Karbala', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 12, 'name' => 'Najaf', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 13, 'name' => 'Babil', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 14, 'name' => 'Wasit', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 15, 'name' => 'Maysan', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 16, 'name' => 'Dhi Qar', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 17, 'name' => 'Muthanna', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
['id' => 18, 'name' => 'Al-Qadisiyyah', 'created_at' => now(), 'updated_at' => now()],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ Route::prefix('auth')
|
|||||||
->name('auth.')
|
->name('auth.')
|
||||||
->controller(AuthController::class)
|
->controller(AuthController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::post('register', 'register')->name('register');
|
|
||||||
Route::post('login', 'login')->name('login');
|
Route::post('login', 'login')->name('login');
|
||||||
Route::post('logout', 'logout')->name('logout');
|
Route::post('logout', 'logout')->name('logout');
|
||||||
});
|
});
|
||||||
@@ -78,7 +77,7 @@ Route::prefix('expert')
|
|||||||
|
|
||||||
Route::prefix('profile')
|
Route::prefix('profile')
|
||||||
->name('profile.')
|
->name('profile.')
|
||||||
->middleware('auth')
|
->middleware('auth:expert')
|
||||||
->controller(ProfileController::class)
|
->controller(ProfileController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::get('info', 'info')->name('info');
|
Route::get('info', 'info')->name('info');
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ use App\Admin\Controllers\RoleManagementController;
|
|||||||
use App\Admin\Controllers\UserManagementController;
|
use App\Admin\Controllers\UserManagementController;
|
||||||
use App\User\Controllers\AuthController;
|
use App\User\Controllers\AuthController;
|
||||||
use App\User\Controllers\GatewayManagementController;
|
use App\User\Controllers\GatewayManagementController;
|
||||||
|
use App\User\Controllers\CityController;
|
||||||
use App\User\Controllers\ProfileController;
|
use App\User\Controllers\ProfileController;
|
||||||
|
use App\User\Controllers\ProvinceController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::prefix('auth')
|
Route::prefix('auth')
|
||||||
@@ -39,3 +41,17 @@ Route::prefix('user_gateway')
|
|||||||
Route::post('/{gateway}', 'update')->name('update');
|
Route::post('/{gateway}', 'update')->name('update');
|
||||||
Route::delete('/{gateway}', 'destroy')->name('destroy');
|
Route::delete('/{gateway}', 'destroy')->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('province')
|
||||||
|
->name('province.')
|
||||||
|
->controller(ProvinceController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('list', 'list')->name('list');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::prefix('city')
|
||||||
|
->name('city.')
|
||||||
|
->controller(CityController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('list', 'list')->name('list');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user