nova sber permission
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Repos\Order\OrderRepo;
|
|||||||
use App\Repos\System\Nova\NovaRepo;
|
use App\Repos\System\Nova\NovaRepo;
|
||||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||||
use App\Repos\System\Settings\Location\RegionRepo;
|
use App\Repos\System\Settings\Location\RegionRepo;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Nova\Fields\Badge;
|
use Laravel\Nova\Fields\Badge;
|
||||||
@@ -58,6 +59,27 @@ class NovaSberPaymentOrder extends Resource
|
|||||||
*/
|
*/
|
||||||
public static $with = ['branch'];
|
public static $with = ['branch'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the resource should automatically poll for new resources.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public static $polling = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interval at which Nova should poll for new resources.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public static $pollingInterval = 120;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether to show the polling toggle button inside Nova.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public static $showPollingToggle = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the displayable label of the resource.
|
* Get the displayable label of the resource.
|
||||||
*/
|
*/
|
||||||
@@ -82,6 +104,27 @@ class NovaSberPaymentOrder extends Resource
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an "index" query for the given resource.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public static function indexQuery(NovaRequest $request, mixed $query): Builder
|
||||||
|
{
|
||||||
|
$user = $request->user();
|
||||||
|
|
||||||
|
if ($user->isAdmin()) {
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->isOperator()) {
|
||||||
|
return $query->whereIn('branch_id', $user->branches()->pluck('branches.id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->where('user_id', $request->user()->id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After resource created
|
* After resource created
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class OrderRepo
|
|||||||
public static function statusValues(): array
|
public static function statusValues(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'' => '',
|
||||||
|
null => '',
|
||||||
self::PENDING => __('Pending'),
|
self::PENDING => __('Pending'),
|
||||||
self::REGISTER => __('Registered'),
|
self::REGISTER => __('Registered'),
|
||||||
self::PROCESSING => __('Processing'),
|
self::PROCESSING => __('Processing'),
|
||||||
|
|||||||
Reference in New Issue
Block a user