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