Add description field for files
This commit is contained in:
parent
bbfad3a0ef
commit
3ddee56359
@ -38,8 +38,9 @@ class FilesController extends Controller
|
||||
// it leaves the parent forms all blank, even though it goes
|
||||
// back to the right place. So just manually validate
|
||||
$validator = Validator::make($request->all(), [
|
||||
'filename' => 'required',
|
||||
'file' => 'required|file'
|
||||
'filename' => 'required',
|
||||
'file_description' => 'nullable',
|
||||
'file' => 'required|file'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
@ -53,6 +54,7 @@ class FilesController extends Controller
|
||||
|
||||
$asset = new File();
|
||||
$asset->name = $attrs['filename'];
|
||||
$asset->description = $attrs['file_description'];
|
||||
$asset->disk = config('filesystems.public_files');
|
||||
$asset->path = $file_path;
|
||||
$asset->public = true;
|
||||
|
@ -56,9 +56,9 @@ Pass in:
|
||||
{{ Form::hidden('ref_model', get_class($model)) }}
|
||||
{{ Form::hidden('ref_model_id', $model->id) }}
|
||||
|
||||
{{ Form::label('filename', 'Name:') }} <span class="required">*</span>
|
||||
{{ Form::text('filename', null, ['class' => 'form-control']) }}
|
||||
|
||||
<span class="required">*</span>
|
||||
{{ Form::text('filename', null, ['class' => 'form-control', 'placeholder' => 'Name']) }}
|
||||
{{ Form::text('file_description', null, ['class' => 'form-control', 'placeholder' => 'Description']) }}
|
||||
{{ Form::file('file', ['class' => 'form-control']) }}
|
||||
|
||||
{{ Form::submit('Upload', ['class' => 'btn btn-success']) }}
|
||||
|
Loading…
Reference in New Issue
Block a user