1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/ViewComposers/PortalComposer.php

67 lines
1.3 KiB
PHP
Raw Normal View History

2019-07-19 06:32:51 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\ViewComposers;
2019-08-12 00:33:17 +02:00
use App\Utils\TranslationHelper;
2019-07-19 06:32:51 +02:00
use Illuminate\View\View;
/**
* Class PortalComposer
* @package App\Http\ViewComposers
*/
class PortalComposer
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
2019-07-22 05:54:34 +02:00
public function compose(View $view) :void
2019-07-19 06:32:51 +02:00
{
2019-08-12 00:33:17 +02:00
$view->with($this->portalData());
2019-07-19 06:32:51 +02:00
}
/**
* @return array
*/
2019-07-22 05:54:34 +02:00
private function portalData() :array
2019-07-19 06:32:51 +02:00
{
2019-08-12 00:33:17 +02:00
2019-07-19 06:32:51 +02:00
if(!auth()->user())
return [];
2019-07-22 05:54:34 +02:00
$data['sidebar'] = $this->sidebarMenu();
$data['header'] = [];
$data['footer'] = [];
2019-08-12 00:33:17 +02:00
$data['countries'] = TranslationHelper::getCountries();
2019-07-19 06:32:51 +02:00
return $data;
2019-08-12 00:33:17 +02:00
2019-07-19 06:32:51 +02:00
}
2019-07-22 05:54:34 +02:00
private function sidebarMenu() :array
{
$data = [];
$data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'fa fa-tachometer fa-fw fa-2x'];
$data[] = [ 'title' => ctrans('texts.invoices'), 'url' => 'client.invoices.index', 'icon' => 'fa fa-file-pdf-o fa-fw fa-2x'];
2019-07-22 05:54:34 +02:00
return $data;
2019-08-12 00:33:17 +02:00
2019-07-22 05:54:34 +02:00
}
2019-07-19 06:32:51 +02:00
}