Esempio n. 1
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $post = Post::where('slug', $this->old_slug)->first();
     $post->category_id = $this->category_id;
     $post->name = $this->name;
     $post->slug = $this->slug;
     $post->content = $this->content;
     $post->save();
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('category', function ($slug) {
         return Category::where('slug', $slug)->first();
     });
     $router->bind('post', function ($slug) {
         return Post::where('slug', $slug)->first();
     });
     $router->bind('page', function ($slug) {
         return Page::where('slug', $slug)->first();
     });
 }
Esempio n. 3
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     Post::where('slug', $this->slug)->first()->delete();
 }
Esempio n. 4
0
 /**
  * Display the specified resource.
  *
  * @param  int $year
  * @param  int $month
  * @return Response
  */
 public function show($year, $month = null)
 {
     return view('index', ['posts' => Post::archiveFiltered($year, $month)->with('category')->paginate(3)]);
 }
 /**
  * Display the specified resource.
  *
  * @param  string  $slug
  * @return Response
  */
 public function show($category)
 {
     return view('index', ['posts' => Post::where('category_id', $category->id)->with('category')->orderBy('created_at', 'DESC')->paginate(5)]);
 }
Esempio n. 6
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $archives = Post::archiveLatest('F Y');
     $view->with('archives', $archives);
 }
 /**
  * Get Post by ID
  *
  * @param $post_id
  * @return Post
  */
 public function find($post_id)
 {
     return $this->post->findOrFail($post_id);
 }
Esempio n. 8
0
 /**
  * Display the specified resource.
  *
  * @param  Post $post
  * @return Response
  */
 public function show(Post $post)
 {
     return view('post.show', ['post' => $post, 'comments' => $post->comments()->whereNull('parent_id')->with('childrenRecursive')->orderBy('created_at', 'desc')->get()]);
 }
Esempio n. 9
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     Post::create(['category_id' => $this->category_id, 'name' => $this->name, 'slug' => $this->slug, 'content' => $this->content]);
 }