我使用的表单看起来像bellow,它使用laraveldcat管理包,它使用
webuploader
protected function form()
{
return Form::make(new Claim(), function (Form $form) {
$form->disableListButton();
// Remove the submit button
//$form->disableSubmitButton();
// Remove the reset button
$form->disableResetButton();
// disable `View` checkbox
$form->disableViewCheck();
// disable `Continue editing` checkbox
$form->disableEditingCheck();
// disable `Continue Creating` checkbox
$form->disableCreatingCheck();
$form->title('Upload Documents');
$claim_id = request()->claimid;
$form->action('claim/'.$claim_id);
$ops = [
'Check-in video' => 'Check-in video',
'Check-out video' => 'Check-out video',
'Crash Report' => 'Crash Report',
'Damage Appraisal' => 'Damage Appraisal',
'Demand' => 'Demand',
'Drivers License' => 'Drivers License',
'DV Form' => 'DV Form',
'Email' => 'Email',
'Expense Receipt' => 'Expense Receipt',
'Images' => 'Images',
'Incident Report' => 'Incident Report',
'Insurance Card' => 'Insurance Card',
'Lienholder Info' => 'Lienholder Info',
'Other' => 'Other',
'Policy' => 'Policy',
'Recorded Statement' => 'Recorded Statement',
'Registration' => 'Registration',
'Rental Agreement'=> 'Rental Agreement',
'Title' => 'Title',
'Tow Bill' => 'Tow Bill',
'Vendor Inv'=> 'Vendor Inv'
];
$form->select('DocType', 'Document Type')->options($ops)->required();
$form->text('note','Note (Optional)');
$form->file('File')->accept('jpg,png,gif,jpeg,pdf,doc,docx,txt')->help('Please select a document type above');
});
}
上传功能
public function upload(Request $request)
{
Log::info($request);
}
[2021-02-08 06:21:49] local.INFO: array (
'DocType' => 'Check-out video',
'note' => 'test',
'File' => NULL,
'_file_' => NULL,
'_token' => 'FVlW5En7DXlhqSpqrVUwBBRGFObAY0n3gDyNveOf',
)
[2021-02-08 06:23:53] local.INFO: array (
'_id' => 'LvMDRa3R97Kjnwhf',
'_token' => 'FVlW5En7DXlhqSpqrVUwBBRGFObAY0n3gDyNveOf',
'upload_column' => 'File',
'id' => 'WU_FILE_0',
'name' => 'a.PNG',
'type' => 'image/png',
'lastModifiedDate' => '2/8/2021, 12:23:52 PM',
'size' => '361931',
'_file_' =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'a.PNG',
'mimeType' => 'image/png',
'error' => 0,
'hashName' => NULL,
)),
)