ldc-mesbr-app/app/Http/Requests/Fo/Basket/PrintRequest.php
2026-10-28 12:27:46 +01:00

41 lines
1 KiB
PHP

<?php
namespace App\Http\Requests\Fo\Basket;
use App\Enums\CampaignTypes;
use Illuminate\Foundation\Http\FormRequest;
class PrintRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
// FIXME: Docblock
protected function prepareForValidation()
{
$campagne = $this->basket->campagne;
throw_unless($campagne->camp_type->equals(CampaignTypes::panier()), \Exception::class, 'Campaign is not basket.');
throw_if($campagne->camp_published === 0, \Exception::class, 'Campaign is not published.');
throw_if($campagne->site->crm_token === null, \Exception::class, 'CRM Token is missing.');
throw_if($campagne->site->crm_password === null, \Exception::class, 'CRM Password is missing.');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [];
}
}