public function create($input, $filename) { $newPhoto = new Photo(); $newPhoto->photo_name = $input['photo_name']; $newPhoto->photo_description = $input['photo_description']; $newPhoto->photo_path = $filename; $newPhoto->album_id = $input['album_id']; return $newPhoto->save(); }
public function create(Request $request, Filesystem $storage) { $filename = str_random(10) . time() . "." . $request->file('photo_file')->getClientOriginalExtension(); $storage->put('uploads/photos/' . $filename, \File::get($request->file('photo_file'))); $input = $request->input(); $newPhoto = new Photo(); $newPhoto->photo_name = $input['photo_name']; $newPhoto->photo_description = $input['photo_description']; $newPhoto->filename = $filename; $newPhoto->album_id = $input['album_id']; return $newPhoto->save(); }