1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00
invoiceninja/app/Http/Controllers/ClientPortal/InvitationController.php

52 lines
1.2 KiB
PHP
Raw Normal View History

2019-09-23 07:59:01 +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\Controllers\ClientPortal;
use App\Http\Controllers\Controller;
use App\Models\InvoiceInvitation;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
/**
* Class InvitationController
* @package App\Http\Controllers\ClientPortal\InvitationController
*/
class InvitationController extends Controller
{
use MakesHash;
use MakesDates;
public function invoiceRouter(string $invitation_key)
{
2019-09-24 00:37:38 +02:00
$invitation = InvoiceInvitation::whereRaw("BINARY `invitation_key`= ?", [$invitation_key])->first();
2019-09-23 07:59:01 +02:00
if($invitation){
if((bool)$invitation->contact->client->getSetting('enable_client_portal_password') !== false)
$this->middleware('auth:contact');
$invitation->markViewed();
return redirect()->route('client.invoice.show', ['invoice' => $this->encodePrimaryKey($invitation->invoice_id)]);
2019-09-23 07:59:01 +02:00
}
else
abort(404);
}
}