本文整理汇总了PHP中app\Category::site_access方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::site_access方法的具体用法?PHP Category::site_access怎么用?PHP Category::site_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Category
的用法示例。
在下文中一共展示了Category::site_access方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Show the form for editing the specified news.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function edit($id)
{
$news = News::find($id);
$sitelanguages = Sitelanguages::site_access()->join('sites', function ($join) {
$join->on('sites.id', '=', 'sitelanguages.sites_id');
})->join('languages', 'languages.id', '=', 'sitelanguages.languages_id')->select('sitelanguages.id', \DB::raw(' CONCAT(sites.title, \'-\',languages.code) as site_language'))->get()->lists('site_language', 'id')->prepend('Please select', '');
$category = Category::site_access()->join('sitelanguages', 'sitelanguages.id', '=', 'category.sitelanguages_id')->join('languages', 'languages.id', '=', 'sitelanguages.languages_id')->join('sites', 'sites.id', '=', 'sitelanguages.sites_id')->select('category.id', 'category.title')->get()->lists('title', 'id')->prepend('Please select', '');
return view('admin.news.edit', compact('news', "sitelanguages", "category"));
}
示例2: index
/**
* Display a listing of category
*
* @param Request $request
*
* @return \Illuminate\View\View
*/
public function index(Request $request)
{
$category = Category::site_access()->leftJoin('sitelanguages', 'sitelanguages.id', '=', 'category.sitelanguages_id')->join('sites', 'sites.id', '=', 'sitelanguages.sites_id')->join('languages', 'languages.id', '=', 'sitelanguages.languages_id')->select('category.*', \DB::raw('CONCAT(sites.title, \'-\',languages.code) as site_language'))->get();
return view('admin.category.index', compact('category'));
}