generated from liutk/owl-admin-base
113 lines
4.3 KiB
PHP
113 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use App\Models\Article;
|
|
use App\Models\Ad;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ArticleController extends Controller
|
|
{
|
|
public function info(Article $article)
|
|
{
|
|
$nav = 'article';
|
|
$nav_title = '服务项目';
|
|
$nav_title_too = $article->title;
|
|
$list = [];
|
|
$banner = Ad::where('address','service-top')->show()->sort()->first();
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
|
|
$content = $article->content;
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
|
|
public function examples()
|
|
{
|
|
$nav = 'image_list';
|
|
$nav_title = '案例展示';
|
|
$nav_title_too = null;
|
|
$content = null;
|
|
$article = null;
|
|
|
|
$banner = Ad::where('address','examples-top')->show()->sort()->first();
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
$list = Article::where('category', 'examples')->show()->sort()->get();
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
|
|
public function company(){
|
|
$nav = 'article';
|
|
$nav_title = '公司介绍';
|
|
$nav_title_too = null;
|
|
$article = null;
|
|
$list = [];
|
|
$banner = Ad::where('address','companny-top')->show()->sort()->first();
|
|
$content = settings()->get('company', '');
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
|
|
public function contactus()
|
|
{
|
|
$nav = 'article';
|
|
$nav_title = '联系我们';
|
|
$nav_title_too = null;
|
|
$article = null;
|
|
$list = [];
|
|
|
|
$banner = Ad::where('address','contactus-top')->show()->sort()->first();
|
|
$content = settings()->get('contactus', '');
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
|
|
public function newsList()
|
|
{
|
|
$nav = 'news_list';
|
|
$nav_title = '资讯动态';
|
|
$nav_title_too = null;
|
|
$content = null;
|
|
$article = null;
|
|
|
|
$banner = Ad::where('address','news-top')->show()->sort()->first();
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
$list = Article::where('category', 'news')->show()->sort()->get();
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
|
|
public function searchList(Request $request)
|
|
{
|
|
$keywords = $request->input('keywords');
|
|
$nav = 'search_list';
|
|
$nav_title = '搜索';
|
|
$nav_title_too = null;
|
|
$content = null;
|
|
$article = null;
|
|
|
|
$banner = Ad::where('address','service-top')->show()->sort()->first();
|
|
|
|
$examples = Article::where('category', 'examples')->show()->recommend()->sort()->limit(10)->get();
|
|
$news = Article::where('category', 'news')->show()->recommend()->sort()->limit(5)->get();
|
|
$list = Article::where('title', 'like', $keywords.'%')->show()->sort()->get();
|
|
|
|
return view('article', compact('banner','news','examples','nav', 'nav_title', 'nav_title_too', 'list', 'article', 'content'));
|
|
}
|
|
}
|