mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Moving permissions to form requests
This commit is contained in:
parent
c144a1c604
commit
05bd8d9318
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Commands;
|
||||
<?php namespace App\Commands;
|
||||
|
||||
abstract class Command
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Services\BankAccountService;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Console;
|
||||
<?php namespace App\Console;
|
||||
|
||||
use Utils;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
|
@ -146,10 +146,8 @@ class ClientController extends BaseController
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(ClientRequest $request)
|
||||
{
|
||||
$this->authorizeCreate();
|
||||
|
||||
if (Client::scope()->withTrashed()->count() > Auth::user()->getMaxNumClients()) {
|
||||
return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients()." clients"]);
|
||||
}
|
||||
@ -175,9 +173,7 @@ class ClientController extends BaseController
|
||||
public function edit(ClientRequest $request)
|
||||
{
|
||||
$client = $request->entity();
|
||||
|
||||
$this->authorize('edit', $client);
|
||||
|
||||
|
||||
$data = [
|
||||
'client' => $client,
|
||||
'method' => 'PUT',
|
||||
|
@ -12,6 +12,7 @@ use App\Models\Client;
|
||||
use App\Services\CreditService;
|
||||
use App\Ninja\Repositories\CreditRepository;
|
||||
use App\Http\Requests\CreateCreditRequest;
|
||||
use App\Http\Requests\CreditRequest;
|
||||
|
||||
class CreditController extends BaseController
|
||||
{
|
||||
@ -55,23 +56,21 @@ class CreditController extends BaseController
|
||||
return $this->creditService->getDatatable($clientPublicId, Input::get('sSearch'));
|
||||
}
|
||||
|
||||
public function create($clientPublicId = 0)
|
||||
public function create(CreditRequest $request)
|
||||
{
|
||||
$this->authorizeCreate();
|
||||
|
||||
$data = array(
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId,
|
||||
//'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : $invoicePublicId,
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
||||
'credit' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'credits',
|
||||
'title' => trans('texts.new_credit'),
|
||||
//'invoices' => Invoice::scope()->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), );
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
);
|
||||
|
||||
return View::make('credits.edit', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
public function edit($publicId)
|
||||
{
|
||||
$credit = Credit::scope($publicId)->firstOrFail();
|
||||
@ -90,7 +89,8 @@ class CreditController extends BaseController
|
||||
|
||||
return View::make('credit.edit', $data);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public function store(CreateCreditRequest $request)
|
||||
{
|
||||
$credit = $this->creditRepo->save($request->input());
|
||||
|
@ -17,6 +17,8 @@ use App\Models\Expense;
|
||||
use App\Models\Client;
|
||||
use App\Services\ExpenseService;
|
||||
use App\Ninja\Repositories\ExpenseRepository;
|
||||
|
||||
use App\Http\Requests\ExpenseRequest;
|
||||
use App\Http\Requests\CreateExpenseRequest;
|
||||
use App\Http\Requests\UpdateExpenseRequest;
|
||||
|
||||
@ -69,17 +71,16 @@ class ExpenseController extends BaseController
|
||||
return $this->expenseService->getDatatableVendor($vendorPublicId);
|
||||
}
|
||||
|
||||
public function create($vendorPublicId = null, $clientPublicId = null)
|
||||
public function create(ExpenseRequest $request)
|
||||
{
|
||||
$this->authorizeCreate();
|
||||
|
||||
if($vendorPublicId != 0) {
|
||||
$vendor = Vendor::scope($vendorPublicId)->with('vendorcontacts')->firstOrFail();
|
||||
if ($request->vendor_id != 0) {
|
||||
$vendor = Vendor::scope($request->vendor_id)->with('vendorcontacts')->firstOrFail();
|
||||
} else {
|
||||
$vendor = null;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $vendorPublicId,
|
||||
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
|
||||
'expense' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'expenses',
|
||||
@ -87,20 +88,18 @@ class ExpenseController extends BaseController
|
||||
'vendors' => Vendor::scope()->with('vendorcontacts')->orderBy('name')->get(),
|
||||
'vendor' => $vendor,
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
'clientPublicId' => $clientPublicId,
|
||||
);
|
||||
'clientPublicId' => $request->client_id,
|
||||
);
|
||||
|
||||
$data = array_merge($data, self::getViewModel());
|
||||
|
||||
return View::make('expenses.edit', $data);
|
||||
}
|
||||
|
||||
public function edit($publicId)
|
||||
public function edit(ExpenseRequest $request)
|
||||
{
|
||||
$expense = Expense::scope($publicId)->with('documents')->firstOrFail();
|
||||
|
||||
$this->authorize('edit', $expense);
|
||||
|
||||
$expense = $request->entity();
|
||||
|
||||
$expense->expense_date = Utils::fromSqlDate($expense->expense_date);
|
||||
|
||||
$actions = [];
|
||||
@ -108,15 +107,6 @@ class ExpenseController extends BaseController
|
||||
$actions[] = ['url' => URL::to("invoices/{$expense->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")];
|
||||
} else {
|
||||
$actions[] = ['url' => 'javascript:submitAction("invoice")', 'label' => trans("texts.invoice_expense")];
|
||||
|
||||
/*
|
||||
// check for any open invoices
|
||||
$invoices = $task->client_id ? $this->invoiceRepo->findOpenInvoices($task->client_id) : [];
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
$actions[] = ['url' => 'javascript:submitAction("add_to_invoice", '.$invoice->public_id.')', 'label' => trans("texts.add_to_invoice", ["invoice" => $invoice->invoice_number])];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
$actions[] = \DropdownButton::DIVIDER;
|
||||
@ -131,7 +121,7 @@ class ExpenseController extends BaseController
|
||||
'vendor' => null,
|
||||
'expense' => $expense,
|
||||
'method' => 'PUT',
|
||||
'url' => 'expenses/'.$publicId,
|
||||
'url' => 'expenses/'.$expense->public_id,
|
||||
'title' => 'Edit Expense',
|
||||
'actions' => $actions,
|
||||
'vendors' => Vendor::scope()->with('vendorcontacts')->orderBy('name')->get(),
|
||||
@ -155,9 +145,7 @@ class ExpenseController extends BaseController
|
||||
{
|
||||
$data = $request->input();
|
||||
$data['documents'] = $request->file('documents');
|
||||
|
||||
$this->authorizeUpdate($data);
|
||||
|
||||
|
||||
$expense = $this->expenseService->save($data);
|
||||
|
||||
Session::flash('message', trans('texts.updated_expense'));
|
||||
@ -174,9 +162,7 @@ class ExpenseController extends BaseController
|
||||
{
|
||||
$data = $request->input();
|
||||
$data['documents'] = $request->file('documents');
|
||||
|
||||
$this->authorizeUpdate($data);
|
||||
|
||||
|
||||
$expense = $this->expenseService->save($data);
|
||||
|
||||
Session::flash('message', trans('texts.created_expense'));
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Controllers;
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use Utils;
|
||||
use View;
|
||||
|
@ -25,6 +25,7 @@ use App\Ninja\Repositories\AccountRepository;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
use App\Http\Requests\PaymentRequest;
|
||||
use App\Http\Requests\CreatePaymentRequest;
|
||||
use App\Http\Requests\UpdatePaymentRequest;
|
||||
|
||||
@ -67,10 +68,8 @@ class PaymentController extends BaseController
|
||||
return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
|
||||
}
|
||||
|
||||
public function create($clientPublicId = 0, $invoicePublicId = 0)
|
||||
public function create(PaymentRequest $request)
|
||||
{
|
||||
$this->authorizeCreate();
|
||||
|
||||
$invoices = Invoice::scope()
|
||||
->where('is_recurring', '=', false)
|
||||
->where('is_quote', '=', false)
|
||||
@ -79,8 +78,8 @@ class PaymentController extends BaseController
|
||||
->orderBy('invoice_number')->get();
|
||||
|
||||
$data = array(
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId,
|
||||
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : $invoicePublicId,
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
||||
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : ($request->invoice_id ?: 0),
|
||||
'invoice' => null,
|
||||
'invoices' => $invoices,
|
||||
'payment' => null,
|
||||
@ -94,12 +93,10 @@ class PaymentController extends BaseController
|
||||
return View::make('payments.edit', $data);
|
||||
}
|
||||
|
||||
public function edit($publicId)
|
||||
public function edit(PaymentRequest $request)
|
||||
{
|
||||
$payment = Payment::scope($publicId)->firstOrFail();
|
||||
|
||||
$this->authorize('edit', $payment);
|
||||
|
||||
$payment = $request->entity();
|
||||
|
||||
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
||||
|
||||
$data = array(
|
||||
@ -109,7 +106,7 @@ class PaymentController extends BaseController
|
||||
->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
|
||||
'payment' => $payment,
|
||||
'method' => 'PUT',
|
||||
'url' => 'payments/'.$publicId,
|
||||
'url' => 'payments/'.$payment->public_id,
|
||||
'title' => trans('texts.edit_payment'),
|
||||
'paymentTypes' => Cache::get('paymentTypes'),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), );
|
||||
@ -589,9 +586,7 @@ class PaymentController extends BaseController
|
||||
public function store(CreatePaymentRequest $request)
|
||||
{
|
||||
$input = $request->input();
|
||||
|
||||
$this->authorizeUpdate($input);
|
||||
|
||||
|
||||
$input['invoice_id'] = Invoice::getPrivateId($input['invoice']);
|
||||
$input['client_id'] = Client::getPrivateId($input['client']);
|
||||
$payment = $this->paymentRepo->save($input);
|
||||
@ -608,11 +603,7 @@ class PaymentController extends BaseController
|
||||
|
||||
public function update(UpdatePaymentRequest $request)
|
||||
{
|
||||
$input = $request->input();
|
||||
|
||||
$this->authorizeUpdate($input);
|
||||
|
||||
$payment = $this->paymentRepo->save($input);
|
||||
$payment = $this->paymentRepo->save($request->input());
|
||||
|
||||
Session::flash('message', trans('texts.updated_payment'));
|
||||
|
||||
|
@ -90,7 +90,7 @@ class TaskController extends BaseController
|
||||
|
||||
$data = [
|
||||
'task' => null,
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId,
|
||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($clientPublicId ?: 0),
|
||||
'method' => 'POST',
|
||||
'url' => 'tasks',
|
||||
'title' => trans('texts.new_task'),
|
||||
|
@ -23,6 +23,7 @@ use App\Models\Country;
|
||||
use App\Ninja\Repositories\VendorRepository;
|
||||
use App\Services\VendorService;
|
||||
|
||||
use App\Http\Requests\VendorRequest;
|
||||
use App\Http\Requests\CreateVendorRequest;
|
||||
use App\Http\Requests\UpdateVendorRequest;
|
||||
|
||||
@ -38,8 +39,6 @@ class VendorController extends BaseController
|
||||
|
||||
$this->vendorRepo = $vendorRepo;
|
||||
$this->vendorService = $vendorService;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,11 +76,7 @@ class VendorController extends BaseController
|
||||
*/
|
||||
public function store(CreateVendorRequest $request)
|
||||
{
|
||||
$data = $request->input();
|
||||
|
||||
$this->authorizeUpdate($data);
|
||||
|
||||
$vendor = $this->vendorService->save($data);
|
||||
$vendor = $this->vendorService->save($request->input());
|
||||
|
||||
Session::flash('message', trans('texts.created_vendor'));
|
||||
|
||||
@ -94,12 +89,10 @@ class VendorController extends BaseController
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($publicId)
|
||||
public function show(VendorRequest $request)
|
||||
{
|
||||
$vendor = Vendor::withTrashed()->scope($publicId)->with('vendorcontacts', 'size', 'industry')->firstOrFail();
|
||||
|
||||
$this->authorize('view', $vendor);
|
||||
|
||||
$vendor = $request->entity();
|
||||
|
||||
Utils::trackViewed($vendor->getDisplayName(), 'vendor');
|
||||
|
||||
$actionLinks = [
|
||||
@ -125,10 +118,8 @@ class VendorController extends BaseController
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(VendorRequest $request)
|
||||
{
|
||||
$this->authorizeCreate();
|
||||
|
||||
if (Vendor::scope()->count() > Auth::user()->getMaxNumVendors()) {
|
||||
return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumVendors()." vendors"]);
|
||||
}
|
||||
@ -151,16 +142,14 @@ class VendorController extends BaseController
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($publicId)
|
||||
public function edit(VendorRequest $request)
|
||||
{
|
||||
$vendor = Vendor::scope($publicId)->with('vendorcontacts')->firstOrFail();
|
||||
|
||||
$this->authorize('edit', $vendor);
|
||||
$vendor = $request->entity();
|
||||
|
||||
$data = [
|
||||
'vendor' => $vendor,
|
||||
'method' => 'PUT',
|
||||
'url' => 'vendors/'.$publicId,
|
||||
'url' => 'vendors/'.$vendor->public_id,
|
||||
'title' => trans('texts.edit_vendor'),
|
||||
];
|
||||
|
||||
@ -193,11 +182,7 @@ class VendorController extends BaseController
|
||||
*/
|
||||
public function update(UpdateVendorRequest $request)
|
||||
{
|
||||
$data = $request->input();
|
||||
|
||||
$this->authorizeUpdate($data);
|
||||
|
||||
$vendor = $this->vendorService->save($data);
|
||||
$vendor = $this->vendorService->save($request->input());
|
||||
|
||||
Session::flash('message', trans('texts.updated_vendor'));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Middleware;
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Middleware;
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Request;
|
||||
use Closure;
|
||||
|
@ -1,26 +1,18 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class ClientRequest extends BaseRequest {
|
||||
class ClientRequest extends EntityRequest {
|
||||
|
||||
protected $entityType = ENTITY_CLIENT;
|
||||
|
||||
public function entity()
|
||||
{
|
||||
return parent::entity()->load('contacts');
|
||||
$client = parent::entity();
|
||||
|
||||
// eager load the contacts
|
||||
if ($client && ! count($client->contacts)) {
|
||||
$client->load('contacts');
|
||||
}
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
public function authorize()
|
||||
{
|
||||
return $this->user()->can('view', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class CreateCreditRequest extends BaseRequest
|
||||
class CreateCreditRequest extends EntityRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
|
@ -1,9 +1,6 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
||||
class CreateExpenseRequest extends Request
|
||||
class CreateExpenseRequest extends ExpenseRequest
|
||||
{
|
||||
// Expenses
|
||||
/**
|
||||
@ -13,7 +10,7 @@ class CreateExpenseRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('create', ENTITY_EXPENSE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use App\Http\Requests\Request;
|
||||
|
@ -1,10 +1,8 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
use App\Models\Invoice;
|
||||
|
||||
class CreatePaymentRequest extends Request
|
||||
class CreatePaymentRequest extends PaymentRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@ -13,7 +11,7 @@ class CreatePaymentRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('create', ENTITY_PAYMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,9 +1,6 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
// vendor
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class CreateVendorRequest extends Request
|
||||
class CreateVendorRequest extends VendorRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@ -12,7 +9,7 @@ class CreateVendorRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('create', ENTITY_VENDOR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@ use App\Http\Requests\Request;
|
||||
use Input;
|
||||
use Utils;
|
||||
|
||||
class BaseRequest extends Request {
|
||||
class EntityRequest extends Request {
|
||||
|
||||
protected $entityType;
|
||||
private $entity;
|
||||
@ -14,7 +14,7 @@ class BaseRequest extends Request {
|
||||
if ($this->entity) {
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
|
||||
$paramName = $this->entityType . 's';
|
||||
$publicId = $this->$paramName ?: (Input::get('public_id') ?: Input::get('id'));
|
||||
|
||||
@ -27,4 +27,18 @@ class BaseRequest extends Request {
|
||||
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
public function authorize()
|
||||
{
|
||||
if ($this->entity()) {
|
||||
return $this->user()->can('view', $this->entity());
|
||||
} else {
|
||||
return $this->user()->can('create', $this->entityType);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use App\Http\Requests\Request;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use App\Http\Requests\Request;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,10 +1,6 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
||||
|
||||
class UpdateExpenseRequest extends Request
|
||||
class UpdateExpenseRequest extends ExpenseRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@ -13,7 +9,7 @@ class UpdateExpenseRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use App\Http\Requests\Request;
|
||||
|
@ -1,9 +1,6 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
||||
class UpdatePaymentRequest extends Request
|
||||
class UpdatePaymentRequest extends PaymentRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@ -12,7 +9,7 @@ class UpdatePaymentRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use App\Http\Requests\Request;
|
||||
|
@ -1,9 +1,6 @@
|
||||
<?php namespace app\Http\Requests;
|
||||
// vendor
|
||||
use App\Http\Requests\Request;
|
||||
use Illuminate\Validation\Factory;
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class UpdateVendorRequest extends Request
|
||||
class UpdateVendorRequest extends VendorRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@ -12,7 +9,7 @@ class UpdateVendorRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return $this->user()->can('edit', $this->entity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Events\ClientWasCreated;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Carbon;
|
||||
use App\Models\Credit;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Carbon;
|
||||
use App\Models\Expense;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Utils;
|
||||
use Auth;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Utils;
|
||||
use Auth;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Carbon;
|
||||
use App\Events\QuoteWasEmailed;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Auth;
|
||||
use Utils;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Listeners;
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use App\Models\Task;
|
||||
use App\Events\InvoiceWasDeleted;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Models;
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Auth;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace app\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
|
Loading…
Reference in New Issue
Block a user