This commit is contained in:
2024-11-22 23:27:15 +05:00
parent 1916f95c50
commit cdc530fc9f
3 changed files with 70 additions and 5 deletions

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources\Item;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\Request;
trait NovaVisaMasterPaymentOrderItemAuth
{
/** Edit button */
public function authorizedToUpdate(Request $request): bool
{
$user = auth()->user();
if ($user->isMe()) {
return true;
}
return false;
}
/** Update */
public function authorizeToUpdate(Request $request): void
{
$user = auth()->user();
if ($user->isMe()) {
return;
}
throw new AuthorizationException;
}
/** Delete button */
public function authorizedToDelete(Request $request)
{
$user = auth()->user();
if ($user->isMe()) {
return true;
}
return false;
}
/** Delete */
public function authorizeToDelete(Request $request)
{
$user = auth()->user();
if ($user->isMe()) {
return;
}
throw new AuthorizationException;
}
}

View File

@@ -3,6 +3,7 @@
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources;
use App\Models\Branch\Branch;
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Item\NovaVisaMasterPaymentOrderItemAuth;
use App\Nova\Resource;
use Illuminate\Database\Eloquent\Model;
use Laravel\Nova\Fields\Boolean;
@@ -15,6 +16,8 @@ use Laravel\Nova\Http\Requests\NovaRequest;
*/
class NovaVisaMasterPaymentOrderItem extends Resource
{
use NovaVisaMasterPaymentOrderItemAuth;
/**
* The model the resource corresponds to.
*
@@ -102,9 +105,9 @@ class NovaVisaMasterPaymentOrderItem extends Resource
Text::make('Amalyň geçirilen wagty', fn () => $this->created_at->format('H:i, d.m.Y')),
Text::make('Amalyň möçberi', fn () => $this->usd_payment_amount . ' USD'),
Text::make('Amalyň möçberi', fn () => $this->usd_payment_amount.' USD'),
Text::make('Amalyň manat möçberi', fn () => $this->tmt_payment_amount . ' TMT'),
Text::make('Amalyň manat möçberi', fn () => $this->tmt_payment_amount.' TMT'),
Text::make('Amalyň referensi', fn () => $this->payment_order_number),

View File

@@ -36,8 +36,13 @@ Route::middleware(['auth', 'unVerified'])->group(function () {
Route::post('sms-verification', [RegisterController::class, 'verifySmsCode']);
});
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])->name('online-payment-store');
Route::get('online-payment-store-visa-master', [OnlinePaymentController::class, 'visaMaster'])->name('online-payment-store-visa-master');
Route::get('online-payment-store-sber', [OnlinePaymentController::class, 'sber'])->name('online-payment-store-sber');
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])
->name('online-payment-store');
Route::get('online-payment-store-visa-master', [OnlinePaymentController::class, 'visaMaster'])
->name('online-payment-store-visa-master');
Route::get('online-payment-store-sber', [OnlinePaymentController::class, 'sber'])
->name('online-payment-store-sber');
Route::redirect('/', config('nova.path'));