CertRequest.php 520 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 ($this->method() === 'PUT' || $this->method() === 'PATCH') {
  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. }