本文整理汇总了PHP中app\Page::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::where方法的具体用法?PHP Page::where怎么用?PHP Page::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(\App\Http\Requests\StorePageRequest $request, $id)
{
$page = \App\Page::where(['id' => $id])->first();
$page->fill($request->all());
$page->save();
return redirect(url('admin'));
}
示例2: welcome
public function welcome(Service $serviceModel)
{
$sliders = Slider::all();
$services = $serviceModel->getService();
$page = Page::where('name', '=', 'home')->firstOrFail();
return view('welcome')->with('sliders', $sliders)->with('services', $services)->with('page', $page);
}
示例3: show
public function show()
{
$page = Page::where('slug', 'netklubbur')->first();
$data['page'] = $page;
$data['banner'] = $page->banner;
return view('frontend.netklubbur')->with($data);
}
示例4: home
public function home()
{
$data['forsidumyndir'] = \App\Page::where('slug', '_forsidumyndir')->first()->getSubs();
$cats = \App\Category::where('status', 1)->get();
$prods = \App\Product::where('status', 1)->get();
$items = [$cats, $prods];
$kubbar = [];
foreach ($items as $item) {
foreach ($item as $v) {
$frontpaged = trim($v->extras()->get('frontpaged')) ?: 0;
$size = trim($v->extras()->get('size'));
$titill = trim($v->extras()->get('titill')) ?: $v->title;
if ($frontpaged && $frontpaged != 0) {
$kubbar[] = ['title' => $titill, 'size' => $size ? $size : 1, 'frontpaged' => $frontpaged, 'fillimage' => $v->fillimage ? true : false, 'path' => $v->fullPath(), 'image' => $v->img()->first(), 'slug' => $v->slug];
}
}
}
usort($kubbar, function ($a, $b) {
if ($a['frontpaged'] == $b['frontpaged']) {
return 0;
}
return $a['frontpaged'] < $b['frontpaged'] ? -1 : 1;
});
$data['kubbar'] = $kubbar;
return view('frontend.layout')->with($data);
}
示例5: search
public function search()
{
$keywords = Input::get('keyword');
$RecentPage = Page::where('id', '>=', 1)->orderBy('created_at', 'desc')->take(5)->get();
$result = Page::where('title', 'like', '%' . $keywords . '%')->paginate(3);
return view('index.home', ['time' => date('Y-m-d H:i:s')])->withPages($result)->withRecentpages($RecentPage);
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param PageRequest|Request $request
* @param Project $project
* @param Module $module
* @param Page $page
* @return \Illuminate\Http\Response
*/
public function update(PageRequest $request, Project $project, Module $module, Page $page)
{
if (isset($_POST['module_id'])) {
$module_id = $_POST['module_id'];
$pages = Page::where('module_id', '=', $module_id)->get();
foreach ($pages as $page) {
$page->update($request->all());
$page->save();
}
return redirect()->route('project.module.show', [$project, $module]);
}
if (isset($_POST['module_name'])) {
$pages = $_POST;
$module = Module::where('project_id', '=', $project->id)->where('name', '=', $_POST['module_name'])->first();
foreach ($pages as $val) {
if (is_numeric($val)) {
$p = Page::where('id', '=', $val)->first();
$p->module_id = $module->id;
$p->save();
}
}
}
$page->update($request->all());
$page->save();
return redirect()->route('project.module.show', [$project, $module]);
}
示例7: show
public function show(Request $request, $url_name)
{
if ($url_name == 'contact') {
//$data = array('name','mail','note');
/*
foreach($this->in as $val) {
//$pageObjs[$key] = $val;
$pageObjs[$val] = $request->session()->pull($val, '');
}
*/
//session()->forget(['name','mail','note']);
// $obj = $this->page -> where('url_name', $request->path()) -> first();
// $headTitle = $obj -> title;
// $intro_ct = $obj -> intro_content;
$headTitle = 'お問い合わせ';
return view('pages.contact', ['headTitle' => $headTitle]);
} else {
if ($pageObj = Page::where('url_name', $url_name)->first()) {
if ($pageObj->closed == '非公開' && (!Auth::user() || Auth::user()->admin != 99)) {
abort(404);
} else {
return view('pages.page')->with(compact('pageObj'));
}
} else {
abort(404);
}
}
}
示例8: edit
public function edit(Post $post)
{
$data['tags'] = Tag::lists('name', 'id');
$data['pages'] = Page::where('status', 1)->lists('title', 'id');
$data['post'] = $post;
return view('post.update', $data);
}
示例9: show
public function show($slug)
{
$page = Page::where('slug', $slug)->first();
$courses = Course::published()->hasCategory()->orderBy('created_at', 'desc')->take(4)->get();
$articles = Article::published()->orderBy('published_at', 'desc')->take(2)->get();
return view('pages.show', ['page' => $page, 'latest_courses' => $courses, 'latest_articles' => $articles]);
}
示例10: index
public function index(Request $request)
{
$page_slug = trim($request->page_slug);
$pageData = Cache::rememberForever('pageData_' . $page_slug, function () use($page_slug) {
return Page::where('page_slug', $page_slug)->firstOrFail();
});
return view('page.page', ['pageData' => $pageData]);
}
示例11: getItem
public function getItem($cat, $item)
{
$category = Category::where('sef', '=', $cat)->first();
$item = Page::where('sef', $item)->first();
$previous = Page::where('id', '<', $item->id)->orderBy('id', 'desc')->first();
$next = Page::where('id', '>', $item->id)->orderBy('id', 'asc')->first();
$category = Category::where('id', $item->category_id)->first();
return view('steklo.item')->withCategory($category)->withItem($item)->withPrevious($previous)->withNext($next);
}
示例12: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$pages = Page::where('module_id', '=', $_GET)->get();
$existing_pages_count = Page::where('module_id', '=', $_GET)->count();
$projected_pages = Module::where('id', '=', $_GET)->pluck('projected_total_pages');
$pages_count = $projected_pages - $existing_pages_count;
return view('pages.index', compact('pages', 'pages_count'));
}
示例13: index
function index()
{
$first = 'Kenneth';
$last = 'Sinder';
$courses = ['Foundations of Sequential Programs', 'Digital Computers', 'Data Abstraction and Implementation', 'Logic and Computation'];
// TODO: add to DB
$text = Page::where('location', 'about')->first()->text;
return view('about.index')->with(compact('first', 'last', 'courses', 'text'));
}
示例14: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$q = new RecordQueryBuilder($request, 'dommer', DommerRecord::class);
$q->make();
$data = ['prefix' => 'dommer', 'query' => $request->all(), 'columns' => $q->getColumns(), 'sortColumn' => $q->sortColumn, 'sortOrder' => $q->sortOrder, 'intro' => Page::where('name', '=', 'dommer.intro')->first()->body];
$data['records'] = $q->query->join('dommer_kilder', 'dommer.kilde_id', '=', 'dommer_kilder.id')->select('dommer.*', 'dommer_kilder.navn AS kilde_navn')->paginate(50);
$data['kilder'] = $this->getKilder();
return response()->view('dommer.index', $data);
}
示例15: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex(Request $request)
{
if (!$request->jenis) {
return redirect(route('menu', ['jenis' => 'Header']));
} else {
$Menus = Menu::where('lokasi', $request->jenis)->where('parent_id', 0)->orderBy('urutan', 'asc')->get();
$Kategori = Kategori::orderBy('nama_kategori', 'asc')->get();
$Pages = Page::where('draft', 0)->where('arsip', 0)->orderBy('id', 'desc')->get();
return view('admin.menu.index', ['Menus' => $Menus, 'Kategori' => $Kategori, 'Pages' => $Pages, 'Jenis' => $request->jenis]);
}
}