芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/app/Http/Controllers/MemberController.php
all(); if ($file = $request->file('photo_id')) { $name = time() . $file->getClientOriginalName(); $file->move('images/media/', $name); $photo = Photo::create(['file'=>$name]); $input['photo_id'] = $photo->id; } Member::create($input); return back()->with('member_success','Member created successfully!'); } public function edit(Member $member) { return view('member.member-edit', compact('member')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\member $member * @return \Illuminate\Http\Response */ public function update(Request $request, Member $member) { $input = $request->all(); if ($file = $request->file('photo_id')) { $name = time() . $file->getClientOriginalName(); $file->move('images/media/', $name); $photo = Photo::create(['file'=>$name]); $input['photo_id'] = $photo->id; } $member->update($input); return back()->with('member_success','Member updated successfully!'); } public function delete_member(Request $request, Member $member) { if(isset($request->delete_all) && !empty($request->checkbox_array)) { $members = Member::findOrFail($request->checkbox_array); foreach ($members as $member) { $member->delete(); } return back()->with('members_success','Member/s deleted successfully!'); } else { return back(); } $members = Member::findOrFail($request->checkbox_array); foreach ($members as $member) { $member->delete(); } return back(); //return 'works'; } }