Mohammad Khazaee
2 years ago
9 changed files with 173 additions and 22 deletions
-
28app/Http/Controllers/FileController.php
-
2app/Http/Middleware/BindCollectionModelMiddleware.php
-
24app/Http/Middleware/BindFileModelMiddleware.php
-
3app/Http/Requests/FileStoreRequest.php
-
34app/Http/Requests/FileUpdateRequest.php
-
1app/Providers/RouteServiceProvider.php
-
2routes/api.php
-
75tests/Feature/FileUpdateTest.php
-
26tests/Feature/Traits/FileTraits.php
@ -0,0 +1,34 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Requests; |
|||
|
|||
use Illuminate\Foundation\Http\FormRequest; |
|||
|
|||
class FileUpdateRequest extends FormRequest |
|||
{ |
|||
/** |
|||
* Determine if the user is authorized to make this request. |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function authorize() |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* Get the validation rules that apply to the request. |
|||
* |
|||
* @return array<string, mixed> |
|||
*/ |
|||
public function rules() |
|||
{ |
|||
return [ |
|||
"alts" => [app()->collection->alt_required ? "required" : "nullable", 'array'], |
|||
"alts.*" => [app()->collection->alt_required ? "required" : "nullable", 'max:1000'], |
|||
"description" => [app()->collection->description_required ? "required" : "nullable", 'max:300'], |
|||
'original_name' => ["string", "nullable", 'max:300'], |
|||
'published_at' => ['date_format:Y-m-d H:i:s', 'nullable'], |
|||
]; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue