diff --git a/app/Policies/Order/Loan/LoanOrderPolicy.php b/app/Policies/Order/Loan/LoanOrderPolicy.php index 4f1f85f..b0d3cab 100644 --- a/app/Policies/Order/Loan/LoanOrderPolicy.php +++ b/app/Policies/Order/Loan/LoanOrderPolicy.php @@ -13,7 +13,11 @@ class LoanOrderPolicy */ public function viewAny(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -21,7 +25,11 @@ class LoanOrderPolicy */ public function view(User $user, LoanOrder $loanOrder): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -29,7 +37,11 @@ class LoanOrderPolicy */ public function create(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -37,7 +49,11 @@ class LoanOrderPolicy */ public function update(User $user, LoanOrder $loanOrder): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -45,7 +61,11 @@ class LoanOrderPolicy */ public function delete(User $user, LoanOrder $loanOrder): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -53,7 +73,11 @@ class LoanOrderPolicy */ public function restore(User $user, LoanOrder $loanOrder): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -61,6 +85,10 @@ class LoanOrderPolicy */ public function forceDelete(User $user, LoanOrder $loanOrder): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } } diff --git a/app/Policies/Order/Loan/LoanTypePolicy.php b/app/Policies/Order/Loan/LoanTypePolicy.php index addd43b..d98948a 100644 --- a/app/Policies/Order/Loan/LoanTypePolicy.php +++ b/app/Policies/Order/Loan/LoanTypePolicy.php @@ -13,7 +13,11 @@ class LoanTypePolicy */ public function viewAny(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -21,7 +25,11 @@ class LoanTypePolicy */ public function view(User $user, LoanType $loanType): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -29,7 +37,11 @@ class LoanTypePolicy */ public function create(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -37,7 +49,11 @@ class LoanTypePolicy */ public function update(User $user, LoanType $loanType): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -45,7 +61,11 @@ class LoanTypePolicy */ public function delete(User $user, LoanType $loanType): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -53,7 +73,11 @@ class LoanTypePolicy */ public function restore(User $user, LoanType $loanType): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -61,6 +85,10 @@ class LoanTypePolicy */ public function forceDelete(User $user, LoanType $loanType): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } } diff --git a/app/Policies/System/Location/ProvincePolicy.php b/app/Policies/System/Location/ProvincePolicy.php index 4f66108..fb53950 100644 --- a/app/Policies/System/Location/ProvincePolicy.php +++ b/app/Policies/System/Location/ProvincePolicy.php @@ -13,7 +13,11 @@ class ProvincePolicy */ public function viewAny(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -21,7 +25,11 @@ class ProvincePolicy */ public function view(User $user, Province $province): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -29,7 +37,11 @@ class ProvincePolicy */ public function create(User $user): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -37,7 +49,11 @@ class ProvincePolicy */ public function update(User $user, Province $province): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -45,7 +61,11 @@ class ProvincePolicy */ public function delete(User $user, Province $province): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -53,7 +73,11 @@ class ProvincePolicy */ public function restore(User $user, Province $province): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } /** @@ -61,6 +85,10 @@ class ProvincePolicy */ public function forceDelete(User $user, Province $province): bool { - // + if ($user->isAdmin()) { + return true; + } + + return false; } } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 7b9bc1d..46abc0a 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -3,8 +3,14 @@ namespace App\Providers; // use Illuminate\Support\Facades\Gate; +use App\Models\Order\Loan\LoanOrder; +use App\Models\Order\Loan\LoanType; +use App\Models\System\Location\Province; use App\Models\System\Roles\Permission; use App\Models\System\Roles\Role; +use App\Policies\Order\Loan\LoanOrderPolicy; +use App\Policies\Order\Loan\LoanTypePolicy; +use App\Policies\System\Location\ProvincePolicy; use App\Policies\System\Roles\PermissionPolicy; use App\Policies\System\Roles\RolePolicy; use App\Policies\UserPolicy; @@ -19,8 +25,14 @@ class AuthServiceProvider extends ServiceProvider */ protected $policies = [ User::class => UserPolicy::class, + Role::class => RolePolicy::class, Permission::class => PermissionPolicy::class, + + Province::class => ProvincePolicy::class, + + LoanOrder::class => LoanOrderPolicy::class, + LoanType::class => LoanTypePolicy::class, ]; /** diff --git a/database/migrations/2023_11_23_162920_create_loan_orders_table.php b/database/migrations/2023_11_23_162920_create_loan_orders_table.php index 089f756..239c348 100644 --- a/database/migrations/2023_11_23_162920_create_loan_orders_table.php +++ b/database/migrations/2023_11_23_162920_create_loan_orders_table.php @@ -29,7 +29,7 @@ return new class extends Migration $table->string('real_address'); $table->string('passport_serie')->index(); - $table->integer('passport_id')->index(); + $table->string('passport_id')->index(); $table->date('passport_given_at'); $table->string('passport_given_by');