Compare commits
4 Commits
feature/Ed
...
feature/Pr
| Author | SHA1 | Date | |
|---|---|---|---|
| d9f895c382 | |||
| 01bae8474b | |||
| 463ca3f006 | |||
| 1ba141e715 |
@@ -16,7 +16,7 @@ class AuthorizationService
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('fib.authorization.url');
|
||||
$this->channelName = '';
|
||||
$this->channelName = 'fib_authorization';
|
||||
$this->inputParameters = [
|
||||
'client_id' => config('fib.authorization.client_id'),
|
||||
'client_secret' => config('fib.authorization.client_secret'),
|
||||
@@ -51,7 +51,6 @@ class AuthorizationService
|
||||
{
|
||||
return Http::asForm()
|
||||
->throw()
|
||||
->withoutVerifying()
|
||||
->post($this->url, $this->inputParameters)
|
||||
->json();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\User\Controllers;
|
||||
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\City;
|
||||
use App\Models\Province;
|
||||
@@ -11,7 +12,9 @@ use App\User\Requests\Profile\EditRequest;
|
||||
use App\User\Resources\UserResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Throwable;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
@@ -22,27 +25,40 @@ class ProfileController extends Controller
|
||||
return $this->successResponse(new UserResource(Auth::user()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function edit(EditRequest $request): JsonResponse
|
||||
{
|
||||
$user = Auth::user();
|
||||
$province = Province::query()->find($request->province_id);
|
||||
$city = City::query()->find($request->city_id);
|
||||
|
||||
$user->update([
|
||||
'first_name' => $request->first_name,
|
||||
'last_name' => $request->last_name,
|
||||
'national_id' => $request->national_id,
|
||||
'address' => $request->address,
|
||||
'postal_code' => $request->postal_code,
|
||||
'phone_number' => $request->phone_number,
|
||||
'province_id' => $province->id,
|
||||
'province_name' => $province->name,
|
||||
'city_id' => $city->id,
|
||||
'city_name' => $city->name,
|
||||
'birth_date' => $request->birth_date,
|
||||
'email' => $request->email,
|
||||
'kyc_status' => 1,
|
||||
]);
|
||||
DB::transaction(function () use ($user, $province, $city, $request) {
|
||||
if ($user->kyc_status == 0)
|
||||
{
|
||||
$user->documents()->create([
|
||||
'title' => 'id_card',
|
||||
'url' => FileFacade::save($request->file('id_card'), "{$user->id}/"),
|
||||
]);
|
||||
}
|
||||
|
||||
$user->update([
|
||||
'first_name' => $request->first_name,
|
||||
'last_name' => $request->last_name,
|
||||
'national_id' => $request->national_id,
|
||||
'address' => $request->address,
|
||||
'postal_code' => $request->postal_code,
|
||||
'phone_number' => $request->phone_number,
|
||||
'province_id' => $province->id,
|
||||
'province_name' => $province->name,
|
||||
'city_id' => $city->id,
|
||||
'city_name' => $city->name,
|
||||
'birth_date' => $request->birth_date,
|
||||
'email' => $request->email,
|
||||
'kyc_status' => 1,
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
@@ -30,9 +30,7 @@ class EditRequest extends FormRequest
|
||||
return [
|
||||
'first_name' => 'required|string|max:255',
|
||||
'last_name' => 'required|string|max:255',
|
||||
'national_id' => [
|
||||
Rule::prohibitedIf($user->kyc_status == 1), 'string',
|
||||
],
|
||||
'national_id' => [Rule::prohibitedIf($user->kyc_status == 1), 'string',],
|
||||
'email' => 'required|email|max:255',
|
||||
'address' => 'required|string',
|
||||
'postal_code' => 'required|string',
|
||||
@@ -40,6 +38,7 @@ class EditRequest extends FormRequest
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'city_id' => 'required|exists:cities,id',
|
||||
'birth_date' => 'required|date',
|
||||
'id_card' => [Rule::prohibitedIf($user->kyc_status == 1), 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,18 @@ class UserResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'username' => $this->username,
|
||||
'email' => $this->email,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'national_id' => $this->national_id,
|
||||
'address' => $this->address,
|
||||
'postal_code' => $this->postal_code,
|
||||
'phone_number' => $this->phone_number,
|
||||
'province_id' => $this->provonce_id,
|
||||
'province_name' => $this->province_name,
|
||||
'city_id' => $this->city_id,
|
||||
'city_name' => $this->city_name,
|
||||
'birth_date' => $this->birth_date,
|
||||
'kyc_status' => $this->kyc_status,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,12 @@ return [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
'fib_authorization' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/fib/authorization.log'),
|
||||
'level' => 'error',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -21,7 +21,7 @@ return new class extends Migration
|
||||
$table->dateTime('expires_in');
|
||||
$table->foreignId('payment_id')->constrained('payments');
|
||||
$table->string('payment_track_id');
|
||||
$table->foreignId('gateway_id')->constrained('gateways');
|
||||
$table->foreignId('user_gateway_id')->constrained('user_gateways');
|
||||
$table->integer('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CitySeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,125 @@ class CitySeeder extends Seeder
|
||||
*/
|
||||
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',
|
||||
'password' => 'password123@',
|
||||
]);
|
||||
$this->call([
|
||||
ProvinceSeeder::class,
|
||||
CitySeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ProvinceSeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,25 @@ class ProvinceSeeder extends Seeder
|
||||
*/
|
||||
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()],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user