File: D:/HostingSpaces/SBogers10/komma.pro/app/KommaApp/Categories/CategoryController.php
<?php
/**
* Created by PhpStorm.
* User: mike
* Date: 03/08/2018
* Time: 11:04
*/
namespace App\KommaApp\Categories;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\View;
class CategoryController extends Controller
{
/**
* @var CategoryService
*/
private $categoryService;
/**
* CategoryController constructor.
* @param CategoryService $categoryService
*/
public function __construct(CategoryService $categoryService)
{
parent::__construct();
$this->categoryService = $categoryService;
}
/**
* @param String $slug
* @return View
*/
public function show($slug)
{
// Get category by slug
if( ! $category = $this->categoryService->categoryBySlug($slug)) App::abort(404);
return View::make('site.pages.posts.category',[
'category' => $category,
'namespace' => 'posts'
]);
}
}