Compare commits

..

12 Commits

165 changed files with 519 additions and 64 deletions

0
backend/.dockerignore Executable file → Normal file
View File

0
backend/.editorconfig Executable file → Normal file
View File

0
backend/.env.example Executable file → Normal file
View File

0
backend/.gitattributes vendored Executable file → Normal file
View File

0
backend/.gitignore vendored Executable file → Normal file
View File

0
backend/.npmrc Executable file → Normal file
View File

0
backend/Dockerfile Executable file → Normal file
View File

0
backend/Dockerfile.production Executable file → Normal file
View File

0
backend/README.md Executable file → Normal file
View File

0
backend/app/Admin/Controllers/AuthController.php Executable file → Normal file
View File

View File

View File

@@ -67,8 +67,7 @@ class ExpertManagementController extends Controller
*/
public function show(Expert $expert): JsonResponse
{
return $this->successResponse(
new ExpertManagementResource($expert)
return $this->successResponse($expert->load(['roles','permissions'])
);
}

View File

20
backend/app/Admin/Controllers/ProfileController.php Executable file → Normal file
View File

@@ -3,6 +3,7 @@
namespace App\Admin\Controllers;
use App\Admin\Requests\Profile\ChangePasswordRequest;
use App\Admin\Requests\Profile\EditRequest;
use App\Admin\Resources\ExpertResource;
use App\Http\Controllers\Controller;
use App\Traits\ApiResponse;
@@ -19,6 +20,24 @@ class ProfileController extends Controller
return $this->successResponse(new ExpertResource(Auth::guard('expert')->user()));
}
public function edit(EditRequest $request): JsonResponse
{
$expert = $request->user('expert');
$expert->update([
'username' => $request->username,
'first_name' => $request->first_name,
'last_name' => $request->last_name,
'email' => $expert->email,
'national_id' => $request->national_id,
'phone_number' => $request->phone_number,
'province_id' => $request->province_id,
'city_id' => $request->city_id,
]);
return $this->successResponse();
}
public function changePassword(ChangePasswordRequest $request): JsonResponse
{
$expert = Auth::guard('expert')->user();
@@ -34,4 +53,5 @@ class ProfileController extends Controller
return $this->successResponse();
}
}

View File

0
backend/app/Admin/Requests/Auth/LoginRequest.php Executable file → Normal file
View File

0
backend/app/Admin/Requests/Auth/RegisterRequest.php Executable file → Normal file
View File

View File

View File

View File

View File

View File

@@ -27,7 +27,7 @@ class UpdateRequest extends FormRequest
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255', Rule::unique('permission', 'name')->ignore($this->permission->id)],
'name' => ['required', 'string', 'max:255', Rule::unique('permissions', 'name')->ignore($this->permission->id)],
];
}
}

View File

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Admin\Requests\Profile;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class EditRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'username' => 'string|max:255',
'first_name' => 'string',
'last_name' => 'string',
'email' => 'string|email|max:255',
'national_id' => 'string',
'phone_number' => 'string',
'province_id' => 'string',
'city_id' => 'string',
];
}
}

View File

@@ -24,8 +24,8 @@ class StoreRequest extends FormRequest
{
return [
'name' => 'required|string|unique:roles,name',
'permissions' => 'required|array',
'permissions.*.name' => 'required|string|exists:permissions,name',
'permissions' => 'array',
'permissions.*' => 'integer|exists:permissions,id',
];
}
}

View File

@@ -27,9 +27,9 @@ class UpdateRequest extends FormRequest
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255', Rule::unique('roles', 'name')->ignore($this->role->id)],
'permissions' => 'required|array',
'permissions.*.name' => 'required|string|exists:permissions,name',
'name' => ['string', 'max:255', Rule::unique('roles', 'name')->ignore($this->role->id)],
'permissions' => 'array',
'permissions.*' => 'integer|exists:permissions,id',
];
}
}

View File

View File

View File

@@ -1,41 +0,0 @@
<?php
namespace App\Admin\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @method roles()
* @method getAllPermissions()
*/
class ExpertManagementResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'username' => $this->username,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'national_id' => $this->national_id,
'email' => $this->email,
'phone_number' => $this->phone_number,
'province_name' => $this->province_name,
'city_name' => $this->city_name,
'roles' => $this->roles()
->pluck('name')
->values(),
'permissions' => $this->getAllPermissions()
->pluck('name')
->values(),
];
}
}

0
backend/app/Admin/Resources/ExpertResource.php Executable file → Normal file
View File

0
backend/app/Facades/DataTable/DataTable.php Executable file → Normal file
View File

0
backend/app/Facades/DataTable/DataTableFacade.php Executable file → Normal file
View File

0
backend/app/Facades/File/File.php Executable file → Normal file
View File

0
backend/app/Facades/File/FileFacade.php Executable file → Normal file
View File

0
backend/app/Http/Controllers/Controller.php Executable file → Normal file
View File

0
backend/app/Mail/LoginNotificationMail.php Executable file → Normal file
View File

0
backend/app/Models/City.php Executable file → Normal file
View File

0
backend/app/Models/Document.php Executable file → Normal file
View File

3
backend/app/Models/Expert.php Executable file → Normal file
View File

@@ -5,6 +5,7 @@ namespace App\Models;
use Database\Factories\ExpertFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Permission\Traits\HasRoles;
/**
* @method roles()
@@ -14,6 +15,8 @@ class Expert extends Model
{
/** @use HasFactory<ExpertFactory> */
use HasFactory;
use HasRoles;
protected $guarded = ['id'];
protected string $guard_name = 'web';
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\GatewayFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Gateway extends Model
{
/** @use HasFactory<GatewayFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\GatewayCategoryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class GatewayCategory extends Model
{
/** @use HasFactory<GatewayCategoryFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\PaymentFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
/** @use HasFactory<PaymentFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\PaymentStatusFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentStatus extends Model
{
/** @use HasFactory<PaymentStatusFactory> */
use HasFactory;
protected $guarded = ['id'];
}

0
backend/app/Models/Province.php Executable file → Normal file
View File

View File

@@ -10,8 +10,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
use Laravel\Passport\Bridge\Client;
use Laravel\Passport\HasApiTokens;
#[Guarded(['id'])]
@@ -26,14 +24,4 @@ class User extends Authenticatable
{
return $this->morphToMany(Document::class, 'documentable');
}
public function validateForPassportPasswordGrant(string $password): bool
{
return Hash::check($password, $this->password);
}
public function findForPassport(string $username, Client $client): User
{
return $this->where('username', $username)->first();
}
}

View File

@@ -22,8 +22,6 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void
{
Passport::enablePasswordGrant();
Passport::tokensExpireIn(CarbonInterval::minutes(1));
Passport::refreshTokensExpireIn(CarbonInterval::minutes(5));
Passport::personalAccessTokensExpireIn(CarbonInterval::minutes(1));
}
}

0
backend/app/Providers/DataTableServiceProvider.php Executable file → Normal file
View File

0
backend/app/Providers/FileServiceProvider.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/DataTableInput.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/DataTableService.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/Enums/DataType.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/Enums/SearchType.php Executable file → Normal file
View File

View File

View File

View File

0
backend/app/Services/DataTable/Filter/ApplyFilter.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/Filter/Filter.php Executable file → Normal file
View File

View File

View File

0
backend/app/Services/DataTable/Sort/ApplySort.php Executable file → Normal file
View File

0
backend/app/Services/DataTable/Sort/Sort.php Executable file → Normal file
View File

View File

View File

View File

0
backend/app/User/Controllers/AuthController.php Executable file → Normal file
View File

View File

@@ -0,0 +1,14 @@
<?php
namespace App\User\Controllers\Dashboard;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ConfirmController extends Controller
{
public function index()
{
//
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\User\Controller\Dashboard;
use App\Http\Controllers\Controller;
use App\Traits\ApiResponse;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class DocumentationController extends Controller
{
use ApiResponse;
public function store(StoreRequest $request): jsonResponse
{
//
}
public function update(UpdateRequest $request): JsonResponse
{
//
}
}

0
backend/app/User/Controllers/ProfileController.php Executable file → Normal file
View File

0
backend/app/User/Requests/Auth/LoginRequest.php Executable file → Normal file
View File

0
backend/app/User/Requests/Auth/RegisterRequest.php Executable file → Normal file
View File

View File

0
backend/app/User/Requests/Profile/EditRequest.php Executable file → Normal file
View File

0
backend/app/User/Resources/UserResource.php Executable file → Normal file
View File

0
backend/app/User/Services/FIB/AuthorizationService.php Executable file → Normal file
View File

0
backend/app/User/Services/FIB/CancelPaymentService.php Executable file → Normal file
View File

View File

0
backend/app/User/Services/FIB/CreatePaymentService.php Executable file → Normal file
View File

0
backend/app/User/Services/FIB/RefundService.php Executable file → Normal file
View File

0
backend/artisan Executable file → Normal file
View File

0
backend/bootstrap/providers.php Executable file → Normal file
View File

0
backend/composer.json Executable file → Normal file
View File

0
backend/composer.lock generated Executable file → Normal file
View File

0
backend/config/app.php Executable file → Normal file
View File

0
backend/config/cache.php Executable file → Normal file
View File

0
backend/config/database.php Executable file → Normal file
View File

0
backend/config/fib.php Executable file → Normal file
View File

0
backend/config/filesystems.php Executable file → Normal file
View File

0
backend/config/logging.php Executable file → Normal file
View File

0
backend/config/mail.php Executable file → Normal file
View File

0
backend/config/passport.php Executable file → Normal file
View File

0
backend/config/permission.php Executable file → Normal file
View File

0
backend/config/queue.php Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More