App\Repositories\PostRepository::update PHP Метод

update() публичный Метод

Update a post.
public update ( $inputs, $id )
$inputs
$id post id
    public function update($inputs, $id)
    {
        $post = $this->getByColumn($id);
        $this->savePost($post, $inputs);
    }

Usage Example

Пример #1
0
 /**
  * @param array    $data
  * @param int|null $id
  */
 protected function savePost(array $data = [], $id = null)
 {
     // Image Handling
     if (isset($data['image'])) {
         $data['image'] = $this->buildImage($data['slug'], $data['image']);
     }
     // We create the Post
     if ($id === null) {
         $data['author_id'] = Auth::id();
         $this->posts->create($data);
     } else {
         $this->posts->update($data, $id);
     }
 }
All Usage Examples Of App\Repositories\PostRepository::update