当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::where方法代码示例

本文整理汇总了PHP中app\models\Page::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::where方法的具体用法?PHP Page::where怎么用?PHP Page::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Page的用法示例。


在下文中一共展示了Page::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * List all pages.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     // pagination
     $session_type = 'page';
     if (!$request->session()->has('order_by')) {
         $request->session()->put($session_type . '.order_by', 'created_at');
     }
     if (!$request->session()->has('order_dir')) {
         $request->session()->put($session_type . '.order_dir', 'desc');
     }
     if ($request->order_by) {
         $request->session()->put($session_type . '.order_by', $request->order_by);
     }
     if ($request->order_dir) {
         $request->session()->put($session_type . '.order_dir', $request->order_dir);
     }
     $limit = $request->session()->get('limit');
     $orderby = $request->session()->get($session_type . '.order_by') == 'created_at' ? $request->session()->get($session_type . '.order_by') : $request->session()->get('language') . '.' . $request->session()->get($session_type . '.order_by');
     $pages = Page::where('shop_id', $request->session()->get('shop'))->where(function ($query) use($request) {
         if ($request->search) {
             return $query->where('en.name', 'LIKE', '%' . $request->search . '%');
         }
     })->orderBy($orderby, $request->session()->get($session_type . '.order_dir'))->paginate($limit);
     $pages->search = $request->search;
     return view('admin/pages/index', ['pages' => $pages]);
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:31,代码来源:PagesController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $page = Page::where('slug', '=', 'overview')->first();
     $gallery = Page::where('slug', '=', 'gallery')->first();
     $images = explode(',', $gallery->content);
     return view('backend.pages.index', ['page' => $page, 'gallery' => $gallery, 'images' => $images]);
 }
开发者ID:aysenli,项目名称:laravel5-backend,代码行数:12,代码来源:PagesController.php

示例3: getPage

 /**
  * @param string $slug
  *
  * @return \Illuminate\Http\Response
  */
 public function getPage($slug = null)
 {
     if (null === $slug) {
         $page = $this->page->where('slug', '/')->where('draft', 0)->first();
     } else {
         $page = $this->page->where('slug', $slug)->where('draft', 0)->first();
     }
     if (null === $page) {
         abort(404);
     }
     if (null === $slug) {
         return view('templates.home', ['page' => $page]);
     } else {
         return view('templates.default', ['page' => $page]);
     }
 }
开发者ID:littera,项目名称:littera,代码行数:21,代码来源:PagesController.php

示例4: index

 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $gallery = Page::where('slug', '=', 'gallery')->first();
     $images = explode(',', $gallery->content);
     $images = array_slice($images, 0, 16);
     return view('frontend.index', ['images' => $images]);
 }
开发者ID:aysenli,项目名称:laravel5-backend,代码行数:12,代码来源:WelcomeController.php

示例5: postSavePage

 /**
  * Saved edited page; called viea ajax
  * @return String
  */
 public function postSavePage()
 {
     $okay = true;
     $page_id = $_REQUEST['page_id'];
     $page_content = $_REQUEST['thedata'];
     if ($page_id > 0) {
         $page = Page::find($page_id);
     } else {
         $page = new Page();
         $slugify = new Slugify();
         $browser_title = $_REQUEST['browser_title'];
         $page->browser_title = $browser_title;
         $page->slug = $slugify->slugify($browser_title);
         // verify that the slug is not already in the db
         $results = Page::where('slug', $slugify->slugify($browser_title))->get();
         foreach ($results as $result) {
             $okay = false;
         }
     }
     $page->page_content = $page_content;
     if ($okay) {
         $page->save();
         echo "OK";
     } else {
         echo "Browser title is already in use";
     }
 }
开发者ID:marious,项目名称:modern,代码行数:31,代码来源:AdminController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($page = '')
 {
     $menuHtml = $this->menuHtml($page);
     $menuItems = Menu::all();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $page = Page::where('key', $page)->first();
     $categories = Category::orderBy('sort', 'asc')->get();
     $smallCart = $this->smallCart();
     return view('page', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'page' => $page, 'categories' => $categories, 'count' => $smallCart['count'], 'sum' => $smallCart['sum']]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:15,代码来源:PagesController.php

示例7: show

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function show(Request $request)
 {
     $stats['categories'] = Category::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['products'] = Product::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['customers'] = User::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['pages'] = Page::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['blogs'] = Blog::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['orders'] = Order::where('shop_id', '=', $request->session()->get('shop'))->count();
     $stats['revenue'] = Order::where('shop_id', '=', $request->session()->get('shop'))->sum('total');
     return view('admin/dashboard', ['stats' => $stats]);
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:16,代码来源:DashboardController.php

示例8: testExample

 /**
  * A basic test example.
  *
  * @return void
  */
 public function testExample()
 {
     //$this->assertTrue(true);
     //Unauthorized access
     $this->visit('/admin')->seePageIs('login');
     //Logging as Admin
     $admin = User::where('is_admin', '1')->first();
     $this->actingAs($admin)->visit('/admin')->seePageIs('admin');
     $this->actingAs($admin)->visit('/admin/pages/main')->see('Главная страница');
     $this->actingAs($admin)->visit('/admin/pages/main/edit')->see('Редактирование главной страницы');
     $this->actingAs($admin)->visit('/admin/pages/static')->see('Статические страницы');
     try {
         //Opening static page editor
         $static_page = Page::where('id', '>', 1)->firstOrFail();
     } catch (ModelNotFoundException $e) {
     } finally {
         $this->actingAs($admin)->visit('/admin/pages/static/' . $static_page->id . '/edit')->see('Редактирование страницы');
         unset($static_page);
     }
     $this->actingAs($admin)->visit('/admin/pages/static')->click('Создать')->see('Создание страницы');
     $this->actingAs($admin)->visit('/admin/menu')->see('Редактор меню');
     //Create new menu item
     $this->actingAs($admin)->visit('/admin/menu')->click('Создать')->see('Новый пункт меню')->select(0, 'pid')->type('Тест', 'name')->type('test357', 'url')->press('Создать')->seePageIs('/admin/menu');
     try {
         //Delete created item
         $menu = Menu::where('url', 'test357')->firstOrFail();
     } catch (ModelNotFoundException $e) {
     } finally {
         $this->actingAs($admin)->delete('/admin/menu/' . $menu->id);
         $this->assertResponseStatus(302);
         $this->assertRedirectedToRoute('admin.menu');
         $this->followRedirects()->see('Редактор меню');
         unset($menu);
     }
     //File manager
     $this->actingAs($admin)->visit('/admin/files')->see('Файловый менеджер');
     //Users
     $this->actingAs($admin)->visit('/admin/users')->see('Пользователи');
     try {
         //Editing myself
         $user = User::where('id', $admin->id)->firstOrFail();
     } catch (ModelNotFoundException $e) {
     } finally {
         $this->actingAs($admin)->visit('/admin/users/' . $admin->id . '/edit')->see('Редактирование пользователя')->press('Обновить')->seePageIs('/admin/users');
         unset($user);
     }
     //Logout
     $this->actingAs($admin)->visit('/logout')->seePageIs('/');
     //Logging as User
     $user = User::where('is_admin', '0')->first();
     $this->actingAs($user)->get('/admin')->seeStatusCode('403');
     $this->actingAs($user)->visit('/logout')->seePageIs('/');
 }
开发者ID:Comrada,项目名称:laravel-cms,代码行数:58,代码来源:AdminTest.php

示例9: detail

 public function detail($id)
 {
     $page = 'catalog';
     $title = Menu::where('key', $page)->value('name');
     $menuHtml = $this->menuHtml($page);
     $menuItems = Menu::all();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $pageInfo = Page::where('key', $page)->first();
     $categories = Category::orderBy('sort', 'asc')->get();
     $product = Product::with(['category', 'color'])->find($id);
     $product->increment('views');
     $recommended = Product::with('category')->take(4)->get();
     $smallCart = $this->smallCart();
     $cartItem = $this->cartItem($product->id);
     $page = $product;
     $page->title = $product->name;
     return view('site.product', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'title' => $title, 'page' => $page, 'product' => $product, 'categories' => $categories, 'recommended' => $recommended, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'currentItem' => $cartItem, 'currentProductCategory' => $product->category]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:18,代码来源:CatalogController.php

示例10: index

 public function index($page = '')
 {
     //        $title = Menu::where('key', $page)->value('name');
     $categories = Category::orderBy('sort', 'asc')->get();
     $menuHtml = $this->menuHtml($page);
     if (session()->has('cart')) {
         $cartItems = session()->get('cart');
         $sum = $cartItems->sum();
         $count = count($cartItems->all());
     } else {
         $sum = 0;
         $count = 0;
     }
     $menuItems = Menu::all();
     $products = Product::with('category')->orderBy('views', 'desc')->take(8)->get();
     $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render();
     $page = Page::where('key', 'index')->first();
     return view('index', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'categories' => $categories, 'count' => $count, 'sum' => $sum, 'products' => $products, 'indexFlag' => true, 'page' => $page]);
 }
开发者ID:pechatny,项目名称:kolizej,代码行数:19,代码来源:IndexController.php

示例11: index

 public function index($page_url = null)
 {
     if (isset($page_url)) {
         try {
             $page = Page::where('url', '=', $page_url)->firstOrFail();
         } catch (ModelNotFoundException $e) {
             return view('errors.404');
         }
         if (!$page->keywords || !$page->description) {
             $main_page = Page::find(1);
             $page->keywords = $page->keywords ? $page->keywords : $main_page->keywords;
             $page->description = $page->description ? $page->description : $main_page->description;
             unset($main_page);
         }
         return view('page', ['page' => $page, 'menu' => $this->menu]);
     } else {
         return redirect()->route('index');
     }
 }
开发者ID:Comrada,项目名称:laravel-cms,代码行数:19,代码来源:PageController.php

示例12: fetch

 public function fetch()
 {
     $request = Request::path();
     if ($request == '/') {
         $page = Page::where('id', 1)->first();
     } else {
         $page = Page::where('slug', $request)->where('active', 'Yes')->where('publishedDate', '<=', date('Y-m-d H:i:s'))->first();
     }
     if (empty($page)) {
         return View::make('Error/404')->shares('title', 'Page not found!');
     }
     if (!file_exists(APPDIR . 'Templates/' . $this->template . '/' . $page->layout . '.php')) {
         $page->layout = 'default';
     }
     $this->layout = $page->layout;
     $ids = explode(',', $page->sidebars);
     $leftSidebars = Sidebar::whereIn('id', $ids)->where('position', 'LIKE', '%Left%')->get();
     $rightSidebars = Sidebar::whereIn('id', $ids)->where('position', 'LIKE', '%Right%')->get();
     return View::make('Default')->shares('title', $page->pageTitle)->shares('browserTitle', $page->browserTitle)->shares('leftSidebars', $leftSidebars)->shares('rightSidebars', $rightSidebars)->shares('pageID', $page->id)->withContent($page->content);
 }
开发者ID:nova-framework,项目名称:cms,代码行数:20,代码来源:Pages.php

示例13: getShowPage

 /**
  * show generic page.
  *
  * @return response
  */
 public function getShowPage()
 {
     $browser_title = '';
     $page_content = '';
     $page_id = 0;
     // extract page name from the url
     $uri = explode('/', $_SERVER['REQUEST_URI']);
     $target = $uri[1];
     // find matching page in the db
     $page = Page::where('slug', '=', $target)->get();
     // lookup page content
     foreach ($page as $item) {
         $browser_title = $item->browser_title;
         $page_content = $item->page_content;
         $page_id = $item->id;
     }
     if (strlen($browser_title) == 0) {
         header('Location: /page-not-found');
         exit;
     }
     // pass content to some blade template
     echo $this->blade->render('generic_page', compact('browser_title', 'page_content', 'page_id'));
 }
开发者ID:marious,项目名称:modern,代码行数:28,代码来源:PageController.php

示例14: pathname

 public function pathname(Request $request, $pathname)
 {
     return Page::where('pathname', '=', $pathname)->firstOrFail();
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:4,代码来源:PageController.php

示例15: putUpdate

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function putUpdate($id, Request $request)
 {
     $rules = array('title' => 'required', 'content' => 'required');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         //$messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return redirect()->back()->withInput($request->all())->withErrors($validator->messages());
     } else {
         $pagedet = array();
         $pagedet['title'] = $request->input('title');
         $pagedet['slug'] = Str::slug($request->input('title'));
         $pagedet['content'] = $request->input('content');
         $pagedet['active'] = $request->input('active');
         $pagedet['meta_keywords'] = $request->input('meta_keywords');
         $pagedet['meta_description'] = $request->input('meta_description');
         if (Page::where('id', $id)->update($pagedet)) {
             $request->session()->flash('alert-success', 'Page content has been updated successfully');
             return redirect('admin/pages');
         } else {
             return redirect('admin/pages/edit/' . $id)->withInput(Input::get());
         }
     }
 }
开发者ID:udayc,项目名称:travel,代码行数:30,代码来源:PageController.php


注:本文中的app\models\Page::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。