mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 10:24:36 -04:00
Enabled modules CreditController.php
This commit is contained in:
parent
a999534769
commit
0d313f12b0
@ -3,19 +3,13 @@
|
|||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ClientPortal\ShowCreditRequest;
|
use App\Http\Requests\ClientPortal\Credits\ShowCreditRequest;
|
||||||
|
use App\Http\Requests\ClientPortal\Credits\ShowCreditsRequest;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\View\View;
|
|
||||||
|
|
||||||
class CreditController extends Controller
|
class CreditController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
public function index(ShowCreditsRequest $request)
|
||||||
* Display listing of client credits.
|
|
||||||
*
|
|
||||||
* @return Factory|View
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
{
|
||||||
return $this->render('credits.index');
|
return $this->render('credits.index');
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Requests\ClientPortal;
|
namespace App\Http\Requests\ClientPortal\Credits;
|
||||||
|
|
||||||
|
use App\Http\ViewComposers\PortalComposer;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ShowCreditRequest extends FormRequest
|
class ShowCreditRequest extends FormRequest
|
||||||
@ -13,7 +14,8 @@ class ShowCreditRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return !$this->credit->is_deleted;
|
return !$this->credit->is_deleted
|
||||||
|
&& auth('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -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\Credits;
|
||||||
|
|
||||||
|
use App\Http\ViewComposers\PortalComposer;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ShowCreditsRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return auth('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user