1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Enabled modules QuoteController.php

This commit is contained in:
Benjamin Beganović 2021-06-17 14:37:06 +02:00
parent 0d313f12b0
commit 430d39b2f1
6 changed files with 109 additions and 65 deletions

View File

@ -1,11 +1,22 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers\ClientPortal;
use App\Events\Quote\QuoteWasApproved;
use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\ProcessQuotesInBulkRequest;
use App\Http\Requests\ClientPortal\ShowQuoteRequest;
use App\Http\Requests\ClientPortal\Quotes\ProcessQuotesInBulkRequest;
use App\Http\Requests\ClientPortal\Quotes\ShowQuotesRequest;
use App\Http\Requests\ClientPortal\Quotes\ShowQuoteRequest;
use App\Jobs\Invoice\InjectSignature;
use App\Models\Quote;
use App\Utils\Ninja;
@ -25,7 +36,7 @@ class QuoteController extends Controller
*
* @return Factory|View
*/
public function index()
public function index(ShowQuotesRequest $request)
{
return $this->render('quotes.index');
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests\ClientPortal;
use Illuminate\Foundation\Http\FormRequest;
class ProcessQuotesInBulkRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'quotes' => ['array'],
];
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Requests\ClientPortal\Quotes;
use App\Http\ViewComposers\PortalComposer;
use Illuminate\Foundation\Http\FormRequest;
use function auth;
class ProcessQuotesInBulkRequest extends FormRequest
{
public function authorize()
{
return auth('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
}
public function rules()
{
return [
'quotes' => ['array'],
];
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Requests\ClientPortal\Quotes;
use App\Http\ViewComposers\PortalComposer;
use Illuminate\Foundation\Http\FormRequest;
class ShowQuoteRequest extends FormRequest
{
public function authorize()
{
return auth()->user()->client->id === $this->quote->client_id
&& auth('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
}
public function rules()
{
return [
//
];
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Requests\ClientPortal\Quotes;
use App\Http\ViewComposers\PortalComposer;
use Illuminate\Foundation\Http\FormRequest;
class ShowQuotesRequest extends FormRequest
{
public function authorize()
{
return auth('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
}
public function rules()
{
return [
//
];
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\ClientPortal;
use Illuminate\Foundation\Http\FormRequest;
class ShowQuoteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
// return auth()->user()->client->id === $this->quote->client_id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}