2018-11-02 11:54:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Utils\Traits;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class MakesHash
|
|
|
|
* @package App\Utils\Traits
|
|
|
|
*/
|
|
|
|
trait MakesHeaderData
|
|
|
|
{
|
|
|
|
|
|
|
|
use UserSessionAttributes;
|
|
|
|
|
2018-11-27 08:24:26 +01:00
|
|
|
public function headerData() : array
|
2018-11-02 11:54:46 +01:00
|
|
|
{
|
|
|
|
//companies
|
2018-11-26 05:15:08 +01:00
|
|
|
$companies = auth()->user()->companies;
|
2018-11-02 11:54:46 +01:00
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|