CertRequest.php 519 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class CertRequest extends FormRequest
  5. {
  6. public function rules()
  7. {
  8. $unq_domain = '';
  9. if (in_array($this->method(), ['PATCH', 'PUT'], true)) {
  10. $unq_domain = ','.$this->cert->id;
  11. }
  12. return [
  13. 'domain' => 'required|string|unique:node_certificate,domain'.$unq_domain,
  14. 'key' => 'string|nullable',
  15. 'pem' => 'string|nullable',
  16. ];
  17. }
  18. }