<?php

namespace App\Http\Controllers;

use App\Models\Article;
use App\Models\Category;

class ArticleController extends Controller
{

    public function show(Article $article)
    {
        if ($article->url) {
            return redirect($article->url);
        }
        $category = $article->category;
        $parent   = $category->getTop();

        return view('articles.show', compact('article', 'category', 'parent'));
    }

}
