本文整理汇总了PHP中app\Page::whereSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::whereSlug方法的具体用法?PHP Page::whereSlug怎么用?PHP Page::whereSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::whereSlug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$cats = \App\Category::where('status', 1)->where('parent_id', 0)->orderBy('order')->get();
$prods = \App\Product::where('status', 1)->where('category_id', 0)->orderBy('order')->get();
if ($cats) {
$data['items'] = $cats->merge($prods);
} else {
$data['items'] = $prods;
}
$data['seo'] = \App\Page::whereSlug('vorur')->first();
$data['pagetitle'] = 'Vörur';
return view('frontend.products')->with($data);
}
示例2:
@extends('frontend.layout')
@section('content')
<?php
$rootPage = \App\Page::whereSlug(\Request::segment(1))->first();
?>
<div class="Page padded">
<div class="Page__crumbs padded-bottom">
<div class="uk-container uk-container-center">
<div class="uk-width-1-1">
@include('frontend._crumbs', ['crumbs' => $crumbs])
</div>
</div>
</div>
<div class="uk-container uk-container-center">
@if($rootPage->hasSubs())
<div class="uk-grid" data-uk-grid-margin data-uk-grid-match>
<div class="uk-width-large-1-5 uk-width-medium-1-4">
<div class="Subnav">
@include('frontend._subnav')
</div>
</div>
<div class="uk-width-large-4-5 uk-width-medium-3-4">
@include('frontend._page', ['page' => $page])
</div>
</div>
@else
@include('frontend._page', ['page' => $page])
示例3: cards
public function cards()
{
// Hérna eru boxin á forsíðu valin
$cards = [];
// Um SFH
$card1 = Page::whereSlug('um-sfh')->first() ?: false;
if ($card1) {
$cards[] = ['title' => $card1->title, 'content' => shortenClean($card1->content), 'path' => rtrim($card1->path, '/'), 'icon' => 'fa-question'];
}
// Aðilar að SFH
$card2 = Page::whereSlug('adilar-ad-sfh')->first() ?: false;
if ($card2) {
$cards[] = ['title' => $card2->title, 'content' => shortenClean($card2->content), 'path' => rtrim($card2->path, '/'), 'icon' => 'fa-users'];
}
// Hafa samband
$card3 = Page::whereSlug('gjaldskrar')->first() ?: false;
if ($card3) {
$cards[] = ['title' => $card3->title, 'content' => shortenClean($card3->content), 'path' => rtrim($card3->path, '/'), 'icon' => 'fa-money'];
}
// Hafa samband
$card4 = Page::whereSlug('hafa-samband')->first() ?: false;
if ($card4) {
$cards[] = ['title' => $card4->title, 'content' => shortenClean($card4->content), 'path' => rtrim($card4->path, '/'), 'icon' => 'fa-envelope'];
}
return $cards;
}
示例4: show
public function show($slug)
{
$page = Page::whereSlug($slug)->firstOrFail();
$related_pages = Page::where('slug', '!=', $slug)->take(5)->get();
return view('pages.show')->with('page', $page)->with('related_pages', $related_pages);
}
示例5: getBySlug
public function getBySlug($slug)
{
$page = Page::whereSlug($slug)->with(['translations', 'children', 'parent'])->first();
return $page;
}
示例6: lifeAtTeleaus
/**
* Life at Teleaus page
*
* @return $this
*/
public function lifeAtTeleaus()
{
$page = Page::whereSlug('life-at-teleaus')->get()->first();
$contents = $page->contents;
$data = ['parentPage' => 'Career', 'page' => 'Life At Teleaus', 'title' => 'Teleaus | Life At Teleaus', 'content' => $page, 'data' => $contents];
return view('life-at-teleaus')->with($data);
}