public function watch(Request $request) { $page = 'videos-3d'; $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json"); $pages = Pages::where('slug', '=', $page)->first(); $date = $request->year . '-' . $request->month . '-' . $request->day; $movie3D = Movies3D::where('date', '=', $date)->where('slug', '=', $request->slug)->first(); array_set($movie3D, "date", Carbon::createFromFormat('Y-m-d', $movie3D->date)); array_set($movie3D, "url", Movies3D::embedVideo($movie3D->url, true)); //INCREMENT Movies3D::find($movie3D->movies3DId)->increment('watch'); //MORE BLOG $moreMovies3D = Movies3D::orderBy('date', 'desc')->where('movies3DId', '!=', $movie3D->movies3DId)->limit(2)->addSelect('title')->addSelect('date')->addSelect('slug')->get(); foreach ($moreMovies3D as $item) { array_set($item, "date", Carbon::createFromFormat('Y-m-d', $item->date)); } return view('website.movies3D.intern')->with(compact('page', 'pages', 'websiteSettings', 'movie3D', 'moreMovies3D')); }
public function delete(Request $request) { if (!ACL::hasPermission('movies3D', 'delete')) { return redirect(route('movies3D'))->withErrors(['Você não tem permissão para deletar.']); } if ($request->image != "") { if (File::exists($this->folder . $request->image)) { File::delete($this->folder . $request->image); } } Movies3D::find($request->get('movies3DId'))->delete(); $success = "Vídeo excluído com sucesso."; return redirect(route('movies3D'))->with(compact('success')); }