App\Repositories\CategoryRepository::getById PHP Method

getById() public method

Get by category id.
public getById ( $id )
$id
    public function getById($id)
    {
        $category = $this->model->find($id);
        if (!is_null($category)) {
            $category->hot++;
            $category->update();
        }
        return $category;
    }

Usage Example

コード例 #1
0
ファイル: CatController.php プロジェクト: thaida/CMS
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $post = $this->cat_gestion->getById($id);
     //$this->authorize('change', $post);
     $this->cat_gestion->destroy($post);
     return redirect('cat')->with('ok', trans('back/cat.destroyed'));
 }
All Usage Examples Of App\Repositories\CategoryRepository::getById