Add description field for files

This commit is contained in:
Nabeel Shahzad 2018-04-02 11:46:33 -05:00
parent bbfad3a0ef
commit 3ddee56359
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -56,9 +56,9 @@ Pass in:
{{ Form::hidden('ref_model', get_class($model)) }}
{{ Form::hidden('ref_model_id', $model->id) }}
{{ Form::label('filename', 'Name:') }}&nbsp;<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']) }}