1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Http/ViewComposers/PortalComposer.php
David Bomba b7d3f4e7aa
Client Portal conditionals (#3039)
* Fixes for tests

* add additional fields for company settings

* fixes for travis

* update company settings schema

* Disable client portal

* Client Portal middleware

* Working on client portal

* hide portal

* Implement notification channgels for User and ClientContact models

* Push notifications onto queue

* Force authentication if client portal is password protected
2019-11-04 11:22:59 +11:00

75 lines
2.0 KiB
PHP

<?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;
use App\Utils\TranslationHelper;
use Illuminate\View\View;
/**
* Class PortalComposer
* @package App\Http\ViewComposers
*/
class PortalComposer
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view) :void
{
$view->with($this->portalData());
}
/**
* @return array
*/
private function portalData() :array
{
if(!auth()->user())
return [];
$data['sidebar'] = $this->sidebarMenu();
$data['header'] = [];
$data['footer'] = [];
$data['countries'] = TranslationHelper::getCountries();
$data['company'] = auth()->user()->company;
$data['client'] = auth()->user()->client;
$data['settings'] = auth()->user()->client->getMergedSettings();
//\Log::error(print_r($data['settings'],1));
return $data;
}
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'];
$data[] = [ 'title' => ctrans('texts.recurring_invoices'), 'url' => 'client.recurring_invoices.index', 'icon' => 'fa fa-files-o fa-fw fa-2x'];
$data[] = [ 'title' => ctrans('texts.payments'), 'url' => 'client.payments.index', 'icon' => 'fa fa-credit-card fa-fw fa-2x'];
$data[] = [ 'title' => ctrans('texts.payment_methods'), 'url' => 'client.payment_methods.index', 'icon' => 'fa fa-cc-stripe fa-fw fa-2x'];
return $data;
}
}