Files
online.tbbank.gov.tm-larave…/app/Nova/Lenses/VisaMasterMonthlyPaid.php
2025-02-20 15:03:24 +05:00

120 lines
2.7 KiB
PHP

<?php
namespace App\Nova\Lenses;
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForIndex;
use Carbon\Carbon;
use Laravel\Nova\Http\Requests\LensRequest;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Lenses\Lens;
use stdClass;
class VisaMasterMonthlyPaid extends Lens
{
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [];
/**
* Type
*
* @var string
*/
protected string $month = '';
/**
* Get the displayable name of the lens.
*
* @return string
*/
public function name(): string
{
return Carbon::create(date('Y').'-'.$this->month.'-01')->monthName ?? 'Ýanwar';
}
/**
* Create a new lens instance.
*
* @param \Illuminate\Database\Eloquent\Model|null $resource
* @return void
*/
public function __construct($resource = null, string $month = '01')
{
$this->resource = $resource ?: new stdClass;
$this->month = $month;
}
/**
* Get the query builder / paginator for the lens.
*
* @param \Laravel\Nova\Http\Requests\LensRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @return mixed
*/
public static function query(LensRequest $request, $query)
{
$query->with('branch', 'paymentItems');
return $request->withOrdering($request->withFilters(
$query
));
}
/**
* Get the fields available to the lens.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function fields(NovaRequest $request): array
{
return VisaMasterPaymentOrderFieldsForIndex::make($this, $this->month);
}
/**
* Get the cards available on the lens.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function cards(NovaRequest $request): array
{
return [];
}
/**
* Get the filters available for the lens.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function filters(NovaRequest $request): array
{
return [];
}
/**
* Get the actions available on the lens.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function actions(NovaRequest $request): array
{
return parent::actions($request);
}
/**
* Get the URI key for the lens.
*
* @return string
*/
public function uriKey(): string
{
return 'visa-master-monthly-paid-'.$this->month;
}
}