class Companies extends ComponentBase
{
public function componentDetails()
{
return [
'name' => 'Список компаний',
'description' => 'Страница со списком компаний'
];
}
public function onRun()
{
$this->page['companies'] = $this->getCompanies();
}
/**
* Получение компаний для страницы сайта
*
*
@return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function getCompanies()
{
return CompanyModel::with('logo')->orderBy('created_at', 'desc')->paginate(6);
}
}