2019-07-19 06:32:51 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-07-19 06:32:51 +02:00
|
|
|
*
|
|
|
|
* @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-12-30 22:59:12 +01: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-12-30 22:59:12 +01:00
|
|
|
if (!auth()->user()) {
|
2019-07-19 06:32:51 +02:00
|
|
|
return [];
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
2019-07-19 06:32:51 +02:00
|
|
|
|
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-08-21 06:29:07 +02:00
|
|
|
$data['company'] = auth()->user()->company;
|
|
|
|
$data['client'] = auth()->user()->client;
|
2019-11-04 01:22:59 +01:00
|
|
|
$data['settings'] = auth()->user()->client->getMergedSettings();
|
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
//\Log::error(print_r($data['settings'],1));
|
2019-08-21 06:29:07 +02:00
|
|
|
|
2019-07-19 06:32:51 +02:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2019-07-22 05:54:34 +02:00
|
|
|
private function sidebarMenu() :array
|
|
|
|
{
|
|
|
|
$data = [];
|
|
|
|
|
2019-07-23 01:25:53 +02:00
|
|
|
$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-08-15 06:31:03 +02:00
|
|
|
$data[] = [ 'title' => ctrans('texts.recurring_invoices'), 'url' => 'client.recurring_invoices.index', 'icon' => 'fa fa-files-o fa-fw fa-2x'];
|
2019-08-16 07:20:28 +02:00
|
|
|
$data[] = [ 'title' => ctrans('texts.payments'), 'url' => 'client.payments.index', 'icon' => 'fa fa-credit-card fa-fw fa-2x'];
|
2019-09-19 12:16:41 +02:00
|
|
|
$data[] = [ 'title' => ctrans('texts.payment_methods'), 'url' => 'client.payment_methods.index', 'icon' => 'fa fa-cc-stripe fa-fw fa-2x'];
|
2019-07-22 05:54:34 +02:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|