phpcs fix customer delete

This commit is contained in:
Jérémy Munsch 2021-08-23 20:00:07 +02:00
parent 234bcfe51f
commit 59bf1f231a
2 changed files with 1 additions and 40 deletions

View file

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Http\Requests\CustomerDeleteRequest;
use App\Models\Brand;
use App\Models\Customer;
use App\Models\CustomerInfo;
@ -66,7 +65,7 @@ class CustomerController extends Controller
return response()->json($customers);
}
public function delete(CustomerDeleteRequest $request, Customer $customer, Brand $brand)
public function delete(Customer $customer, Brand $brand)
{
$nbBrand = $customer->infos()->count();

View file

@ -1,38 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
class CustomerDeleteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'customer' => 'exists:customers,id|required',
'brand' => 'exists:brands,id|required'
];
}
protected function prepareForValidation()
{
$this->merge(['customer' => $this->route('customer')->id, 'brand' => $this->route('brand')->id]);
}
}