36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Requests;
 | |
| 
 | |
| use Illuminate\Foundation\Http\FormRequest;
 | |
| use Illuminate\Support\Facades\Log;
 | |
| 
 | |
| class PostRequest extends FormRequest
 | |
| {
 | |
|     /**
 | |
|      * Determine if the user is authorized to make this request.
 | |
|      */
 | |
|     public function authorize(): bool
 | |
|     {
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Get the validation rules that apply to the request.
 | |
|      *
 | |
|      * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
 | |
|      */
 | |
|     public function rules(): array
 | |
|     {
 | |
|         return [
 | |
|             'KategoriId' => 'required|integer|exists:Kategori,KategoriId',
 | |
|             'SubKategoriId' => 'required|integer|exists:SubKategori,SubKategoriId',
 | |
|             'JudulPost' => ['required', 'string', 'max:255'],
 | |
|             'SlugPost' => ['required', 'string', 'max:255'],
 | |
|             'DescPost' => ['required', 'string'],
 | |
|             'ImagePost' => ['nullable', 'image', 'mimes:jpg,jpeg,png,webp', 'max:2048'],
 | |
|             'IsPublish' => 'boolean',
 | |
|         ];
 | |
|     }
 | |
| }
 |