1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Utils/Traits/MakesHeaderData.php
2019-01-27 10:22:57 +11:00

34 lines
638 B
PHP

<?php
namespace App\Utils\Traits;
/**
* Class MakesHeaderData
* @package App\Utils\Traits
*/
trait MakesHeaderData
{
use UserSessionAttributes;
/**
* @return array
*/
public function headerData() : array
{
//companies
$companies = auth()->user()->companies;
$data['current_company'] = $companies->first(function ($company){
return $company->id == $this->getCurrentCompanyId();
});
$data['companies'] = $companies->reject(function ($company){
return $company->id == $this->getCurrentCompanyId();
});
return $data;
}
}