コード例 #1
0
 /**
  * Display a release landing page.
  *
  * @return \Illuminate\Http\Response
  */
 public function show($permalink)
 {
     $page = Landing::page($permalink);
     if (!isset($page) || !$page->active) {
         return redirect()->route('public.page.home');
     }
     return view('public/landing/show', compact('page'));
 }
コード例 #2
0
 /**
  * Remove the specified landing page from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $page = Landing::where('id', $id)->first();
     $page->delete();
     $path = public_path() . '/images/landing';
     $landingPath = $path . '/' . $page->permalink;
     if (File::exists($landingPath)) {
         $imageLargeName = $page->image_large;
         $imageMediumName = $page->image_medium;
         $imageThumbnailName = $page->image_thumbnail;
         // Delete Images
         $this->image->delete($landingPath, $imageLargeName);
         $this->image->delete($landingPath, $imageMediumName);
         $this->image->delete($landingPath, $imageThumbnailName);
         // Check if there is files into directory
         if ($this->directory->filesEmpty($landingPath)) {
             // Delete post directory
             $this->directory->delete($landingPath);
         }
     }
     session()->flash('message', "Se eliminó la página de aterrizaje \"{$page->title}\" correctamente");
     return redirect()->route('admin.landing.index');
 }