| Current Path : /var/www/html/dynaweb-starter/app/Repositories/ |
| Current File : /var/www/html/dynaweb-starter/app/Repositories/SystemVariableRepository.php |
<?php
namespace App\Repositories;
class SystemVariableRepository extends BaseRepository
{
/***
* Populate Dropdown
*/
public function populate()
{
return $this->model::query()
->pluck('code', 'id')
->map(fn (string $category) => __($category))
->all();
}
/***
* Populate Dropdown
*/
public function populateParent()
{
return $this->model::whereNull('parent_id')
->pluck('code', 'id')
->map(fn (string $category) => __($category))
->all();
}
/***
* set new sortingOrder
*/
public function setNewSorting(String $category, $parentid=null)
{
return $this->model::where('category', $category)
->when(!empty($parentid), fn ($query) => $query->where('parent_id', $parentid))
->count();
}
}