first commit
This commit is contained in:
25
app/Http/Requests/Attachment/CreateAttachmentRequest.php
Normal file
25
app/Http/Requests/Attachment/CreateAttachmentRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Attachment;
|
||||
|
||||
use App\Helpers\AttachmentHelper;
|
||||
use App\Http\Requests\AuthorizesAfterValidation;
|
||||
use App\Http\Requests\CattrFormRequest;
|
||||
|
||||
class CreateAttachmentRequest extends CattrFormRequest
|
||||
{
|
||||
use AuthorizesAfterValidation;
|
||||
|
||||
public function authorizeValidated(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function _rules(): array
|
||||
{
|
||||
$maxFileSize = AttachmentHelper::getMaxAllowedFileSize();
|
||||
return [
|
||||
'attachment' => "file|required|max:$maxFileSize",
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/Attachment/DownloadAttachmentRequest.php
Normal file
23
app/Http/Requests/Attachment/DownloadAttachmentRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Attachment;
|
||||
|
||||
use App\Http\Requests\AuthorizesAfterValidation;
|
||||
use App\Http\Requests\CattrFormRequest;
|
||||
|
||||
class DownloadAttachmentRequest extends CattrFormRequest
|
||||
{
|
||||
use AuthorizesAfterValidation;
|
||||
|
||||
public function authorizeValidated(): bool
|
||||
{
|
||||
return $this->user()->can('view', request('attachment')->project);
|
||||
}
|
||||
|
||||
public function _rules(): array
|
||||
{
|
||||
return [
|
||||
'seconds' => 'sometimes|int'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user