wip
This commit is contained in:
11
app/Models/Order/Card/CardTransaction/CardTransaction.php
Normal file
11
app/Models/Order/Card/CardTransaction/CardTransaction.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Order\Card\CardTransaction;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CardTransaction extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@@ -13,9 +13,9 @@ class LoanOrderPolicy
|
|||||||
*/
|
*/
|
||||||
public function viewAny(User $user): bool
|
public function viewAny(User $user): bool
|
||||||
{
|
{
|
||||||
if ($user->isOperator()) {
|
// if ($user->isOperator()) {
|
||||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
// return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -29,13 +29,17 @@ class LoanOrderPolicy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
if ($user->isOperator()) {
|
||||||
return in_array(
|
return true;
|
||||||
$loanOrder->branch_id,
|
|
||||||
$user->branches->pluck('id')->toArray()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||||
|
// return in_array(
|
||||||
|
// $loanOrder->branch_id,
|
||||||
|
// $user->branches->pluck('id')->toArray()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
if ($user->ownsLoanOrder($loanOrder)) {
|
if ($user->ownsLoanOrder($loanOrder)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -48,8 +52,12 @@ class LoanOrderPolicy
|
|||||||
*/
|
*/
|
||||||
public function create(User $user): bool
|
public function create(User $user): bool
|
||||||
{
|
{
|
||||||
|
// if ($user->isOperator()) {
|
||||||
|
// return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||||
|
// }
|
||||||
|
|
||||||
if ($user->isOperator()) {
|
if ($user->isOperator()) {
|
||||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -64,13 +72,17 @@ class LoanOrderPolicy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
if ($user->isOperator()) {
|
||||||
return in_array(
|
return true;
|
||||||
$loanOrder->branch_id,
|
|
||||||
$user->branches->pluck('id')->toArray()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||||
|
// return in_array(
|
||||||
|
// $loanOrder->branch_id,
|
||||||
|
// $user->branches->pluck('id')->toArray()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
|
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
|
||||||
OrderRepo::PENDING,
|
OrderRepo::PENDING,
|
||||||
])) {
|
])) {
|
||||||
@@ -89,13 +101,17 @@ class LoanOrderPolicy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
if ($user->isOperator()) {
|
||||||
return in_array(
|
return true;
|
||||||
$loanOrder->branch_id,
|
|
||||||
$user->branches->pluck('id')->toArray()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||||
|
// return in_array(
|
||||||
|
// $loanOrder->branch_id,
|
||||||
|
// $user->branches->pluck('id')->toArray()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
if ($user->ownsLoanOrder($loanOrder)) {
|
if ($user->ownsLoanOrder($loanOrder)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?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::create('card_transactions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('card_transactions');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -32,7 +32,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::post('password-change', [PasswordChangeController::class, 'update'])->name('password-change.update');
|
Route::post('password-change', [PasswordChangeController::class, 'update'])->name('password-change.update');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('tester', [ApiTesterController::class, 'index']);
|
// Route::get('tester', [ApiTesterController::class, 'index']);
|
||||||
|
|
||||||
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])
|
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])
|
||||||
->name('online-payment-store');
|
->name('online-payment-store');
|
||||||
|
|||||||
Reference in New Issue
Block a user