public function read(Request $request)
 {
     $page = 'noticias-e-releases';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $date = $request->year . '-' . $request->month . '-' . $request->day;
     $newsAndReleases = NewsAndReleases::where('date', '=', $date)->where('slug', '=', $request->slug)->first();
     array_set($newsAndReleases, "date", Carbon::createFromFormat('Y-m-d', $newsAndReleases->date));
     //INCREMENT
     NewsAndReleases::find($newsAndReleases->newsAndReleasesId)->increment('read');
     //MORE NEWS AND RELEASES
     $moreNewsAndReleases = NewsAndReleases::orderBy('date', 'desc')->where('newsAndReleasesId', '!=', $newsAndReleases->newsAndReleasesId)->limit(2)->addSelect('title')->addSelect('date')->addSelect('slug')->get();
     foreach ($moreNewsAndReleases as $item) {
         array_set($item, "date", Carbon::createFromFormat('Y-m-d', $item->date));
     }
     return view('website.newsAndReleases.intern')->with(compact('page', 'pages', 'websiteSettings', 'newsAndReleases', 'moreNewsAndReleases'));
 }
 public function delete(Request $request)
 {
     if (!ACL::hasPermission('newsAndReleases', 'delete')) {
         return redirect(route('newsAndReleases'))->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);
         }
     }
     NewsAndReleases::find($request->get('newsAndReleasesId'))->delete();
     $success = "Notícia/Release excluída com sucesso.";
     return redirect(route('newsAndReleases'))->with(compact('success'));
 }