first commit
This commit is contained in:
35
app/Http/ViewComposers/Menu.php
Normal file
35
app/Http/ViewComposers/Menu.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Auth;
|
||||
use Illuminate\View\View;
|
||||
use anlutro\LaravelSettings\Facade as Settingg;
|
||||
|
||||
class Menu
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$customer = null;
|
||||
$company_id = session('company_id');
|
||||
|
||||
// Get all companies
|
||||
$companies = Auth::user()->companies()->get()->sortBy('name');
|
||||
foreach ($companies as $com) {
|
||||
$com->setSettings();
|
||||
}
|
||||
|
||||
// Get customer
|
||||
if (Auth::user()->customer) {
|
||||
$customer = Auth::user();
|
||||
}
|
||||
|
||||
$view->with(['companies' => $companies, 'customer' => $customer]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user