Example #1
0
 private function modif(BlogPost $post, array $inputs)
 {
     $post->title = ucfirst($inputs['title']);
     $post->body = $inputs['body'];
     $post->slug = Str::slug($inputs['title'], '-');
     if (isset($inputs['active'])) {
         $active = 1;
     } else {
         $active = 0;
     }
     $post->active = $active;
     $post->category_id = $inputs['category_id'];
     $post->save();
     if ($post->active && !$post->notification_sent) {
         $this->notify($post->id);
         $post->notification_sent = true;
         $post->save();
     }
 }