Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Nov 16, 2019
1 parent 0d53067 commit a8c5aa7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function store(Request $request)
}

// Check if is customer
if ($user->contact) {
if ($user->can('read-client-portal')) {
$path = session('url.intended', 'portal');

// Path must start with 'portal' prefix
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function store(Request $request)
*/
public function edit(User $user)
{
if ($user->contact) {
if ($user->can('read-client-portal')) {
// Show only roles with customer permission
$roles = Role::all()->reject(function ($r) {
return !$r->hasPermission('read-client-portal');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Expenses/Bills.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function show(Bill $bill)

$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();

$currency = Currency::where('code', $bil->currency_code)->first();
$currency = Currency::where('code', $bill->currency_code)->first();

$account_currency_code = Account::where('id', setting('default.account'))->pluck('currency_code')->first();

Expand Down
4 changes: 2 additions & 2 deletions app/Http/ViewComposers/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function compose(View $view)
$company = null;

// Get customer company
if ($user->contact) {
$company = (object)[
if ($user->can('read-client-portal')) {
$company = (object) [
'company_name' => setting('company.name'),
'company_email' => setting('company.email'),
'company_address' => setting('company.address'),
Expand Down
20 changes: 9 additions & 11 deletions app/Listeners/Income/CreateInvoiceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,19 @@ public function handle(Event $event)
} catch (\Exception $e) {
$message = $e->getMessage();

$user = user();

if ($user) {
if ($user->contact) {
flash($message)->error();
if (!$user = user()) {
flash($message)->error();

redirect()->route('signed.invoices.show', $invoice->id)->send();
}

redirect()->route('portal.invoices.show', $invoice->id)->send();
}
if ($user->can('read-client-portal')) {
flash($message)->error();

throw new \Exception($message);
redirect()->route('portal.invoices.show', $invoice->id)->send();
}

flash($message)->error();

redirect()->route('signed.invoices.show', $invoice->id)->send();
throw new \Exception($message);
}
}
}

0 comments on commit a8c5aa7

Please sign in to comment.