*/ public static $model = \App\Modules\LoanRemainingOrder\Models\LoanRemainingOrder::class; /** * The single value that should be used to represent the resource when being displayed. * * @var string */ public static $title = 'account_number'; /** * The columns that should be searched. * * @var array */ public static $search = [ 'account_number', ]; /** * Get the displayable label of the resource. */ public static function label(): string { return __('Karzyƈ galyndysy'); } /** * Build an "index" query for the given resource. * * @param \Illuminate\Database\Eloquent\Builder<\App\Modules\LoanRemainingOrder\Models\LoanRemainingOrder> $query * @return \Illuminate\Database\Eloquent\Builder<\App\Modules\LoanRemainingOrder\Models\LoanRemainingOrder> */ public static function indexQuery(NovaRequest $request, $query): Builder { $user = $request->user(); if ($user->isAdmin()) { return $query; } return $query->where('user_id', $request->user()->id); } /** * Get the fields displayed by the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request): array { return [ ID::make()->sortable(), Hidden::make('user_id') ->default(auth()->id()), Select::make(__('Passport serie'), 'passport_serie') ->displayUsingLabels() ->searchable() ->options(PassportRepo::values()) ->rules('required') ->sortable(), Number::make(__('Passport id'), 'passport_id') ->rules('required', 'numeric', 'digits:6'), Text::make(__('Karz hasaby'), 'account_number') ->rules('required'), new Panel(__('Karz taryhy'), [ NovaCustomHtml::make(__('Karz taryhy'), 'loan_history') ->onlyOnDetail() ->canSeeWhen('systemUser', $this) ->html(view('orders.loan.mobile.loan-remaining', [ 'resource' => $this, ])->render()), ]), ]; } }