wip
This commit is contained in:
@@ -128,7 +128,6 @@ class LoanOrder extends Resource
|
|||||||
Select::make(__('Branch'), 'branch_id')
|
Select::make(__('Branch'), 'branch_id')
|
||||||
->displayUsingLabels()
|
->displayUsingLabels()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(BranchRepo::values())
|
|
||||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion())
|
->dependsOn('region', BranchNovaRepo::dependsOnRegion())
|
||||||
->size('w-1/2')
|
->size('w-1/2')
|
||||||
->rules('required')
|
->rules('required')
|
||||||
|
|||||||
@@ -7,11 +7,53 @@ use Illuminate\Support\Collection;
|
|||||||
|
|
||||||
class BranchRepo
|
class BranchRepo
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Model
|
||||||
|
* @var App\Models\Branch\Branch
|
||||||
|
*/
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New Branch Repo
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = Branch::class;
|
||||||
|
$this->query = $this->model::query();
|
||||||
|
$this->queryActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query active records
|
||||||
|
*/
|
||||||
|
public function queryActive(): self
|
||||||
|
{
|
||||||
|
$this->query->where('active', true);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Make" static sugar
|
||||||
|
*/
|
||||||
|
public static function make(): self
|
||||||
|
{
|
||||||
|
return new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query
|
||||||
|
*/
|
||||||
|
public function query()
|
||||||
|
{
|
||||||
|
return $this->query;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Branch values
|
* Branch values
|
||||||
*/
|
*/
|
||||||
public static function values(): Collection|array
|
public static function values(): Collection|array
|
||||||
{
|
{
|
||||||
return Branch::pluck('name', 'id');
|
return static::make()->pluck('name', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user