You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Http\Requests;
use App\Models\Collection;
use Illuminate\Foundation\Http\FormRequest;
class FileStoreRequest extends FormRequest {
private $collection = null;
public function __construct() {
$this->collection = Collection::where('name',$this->collection_name)->get(); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; }
private function getExts() { return implode(",",$this->collection->exts); }
private function getMimeTypes() { return implode(",",$this->collection->mimetypes); }
// private function getExt()
// {
// return implode(",",$this->collection->ext);
// }
/** * Get the validation rules that apply to the request. * * @return array<string, mixed> */ public function rules() { return [ "ext" => ["mimes:" . $this->getExts], "memetype" => ["mimetypes:" . $this->getMimeTypes], "width"=> [''], "height"=> [''], "file_size"=> [''], ]; } }
|