first commit
This commit is contained in:
28
app/Http/Controllers/ArticleController.php
Normal file
28
app/Http/Controllers/ArticleController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Article;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 显示分类
|
||||
* @param Category $category [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function show(Article $article)
|
||||
{
|
||||
$parent = $category = $article->category;
|
||||
if ($category->childrens->isEmpty()) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
$advert = Advert::where('category_id',73)->first();
|
||||
|
||||
return view('article.show', compact('article', 'parent', 'category','advert'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user