执行死刑的法律执行者
public function store(Request $request)
{
if ($request->hasfile('filename')) {
`enter code here` $file = $request->file('filename');
$name=time().$file->getClientOriginalName();
$file->move(public_path().'/images/', $name);
}
$passport= new \App\Passport;
$passport->name=$request->get('name');
$passport->email=$request->get('email');
$passport->number=$request->get('number');
$date=date_create($request->get('date'));
$format = date_format($date,"Y-m-d");
$passport->date = strtotime($format);
$passport->office=$request->get('office');
$passport->filename=$name;
$passport->save();
return redirect('passports')->with('successo','informação adicionada');
}
答案 0 :(得分:0)
尝试
public function store(Request $request)
{
if ($request->hasfile('filename')) {
`enter code here` $file = $request->file('filename');
$name=time().$file->getClientOriginalName();
$file->move(public_path().'/images/', $name);
}else{
dd('no file input');//changed here
}
$passport= new \App\Passport;
$passport->name=$request->get('name');
$passport->email=$request->get('email');
$passport->number=$request->get('number');
$date=date_create($request->get('date'));
$format = date_format($date,"Y-m-d");
$passport->date = strtotime($format);
$passport->office=$request->get('office');
$passport->filename=$name;
$passport->save();
return redirect('passports')->with('successo','informação adicionada');
}