本文整理汇总了PHP中app\models\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: updatePost
public function updatePost(Request $request, Page $page)
{
$page->fill($request->all());
$page->meta = $request->get('meta', []);
$page->save();
return $this->redirectAction('update', $page);
}
开发者ID:unstoppablecarl,项目名称:laravel-content-pages-example,代码行数:7,代码来源:Articles.php
示例3: getInfo
public function getInfo(Request $request, Page $page, $class, $function)
{
$route = $request->route();
$routeInfo = ['path' => $route->getPath()];
$routeInfo = array_merge($routeInfo, $route->getAction());
$out = ['route' => $routeInfo, '__CLASS__' => $class, '__FUNCTION__' => $function, 'page_model' => $page->toArray()];
return $out;
}
开发者ID:unstoppablecarl,项目名称:laravel-content-pages-example,代码行数:8,代码来源:PageTypeControllerInfo.php
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$examplePages = [['path' => '/', 'page_type' => 'basic', 'content' => 'This is the home page content', 'meta' => null], ['path' => 'about', 'page_type' => 'basic', 'content' => 'This is the about page content', 'meta' => null], ['path' => 'services', 'page_type' => 'basic', 'content' => 'This is the services page content', 'meta' => null], ['path' => 'services/marketing', 'page_type' => 'basic', 'content' => 'This is the services marketing page content', 'meta' => null], ['path' => 'services/production', 'page_type' => 'basic', 'content' => 'This is the services production page content', 'meta' => null], ['path' => 'industry/news', 'page_type' => 'articles', 'content' => 'This is the articles page content', 'meta' => ['content_before_list' => 'Content before list', 'content_after_list' => 'Content after list']], ['path' => 'contact-us', 'page_type' => 'contact', 'content' => 'This is the contact page content', 'meta' => null]];
foreach ($examplePages as $pageData) {
\App\Models\Page::create($pageData);
}
}
开发者ID:unstoppablecarl,项目名称:laravel-content-pages-example,代码行数:12,代码来源:PagesSeeder.php
示例5: destroy
public function destroy($id)
{
$page = Page::find($id);
//$page->delete();
Notification::success('The page was deleted.');
return Redirect::route('admin.pages.index');
}
开发者ID:daniellimafreire,项目名称:l4-site-tutorial,代码行数:7,代码来源:PagesController.php
示例6: 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
示例7: run
public function run()
{
DB::table('user')->delete();
DB::table('pages')->delete();
Article::create(array('title' => 'First post', 'slug' => 'first-post', 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'user_id' => 1));
Page::create(array('title' => 'About us', 'slug' => 'about-us', 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'user_id' => 1));
}
开发者ID:brucewu16899,项目名称:laravel-admin-panel,代码行数:7,代码来源:ContentSeeder.php
示例8: run
public function run()
{
$menu = Menu::find()->where(['position' => 'bottom'])->one();
$p = explode(',', $menu->content);
$model = Page::find()->where(['id' => $p])->all();
return $this->render('links', ['pages' => $model]);
}
开发者ID:sanmaowang,项目名称:ycjl,代码行数:7,代码来源:Links.php
示例9: run
public function run()
{
DB::table('pages')->delete();
for ($i = 0; $i < 10; $i++) {
Page::create(['title' => 'Title ' . $i, 'slug' => 'first-page', 'body' => 'Body ' . $i, 'user_id' => 1]);
}
}
开发者ID:Zachary-Leung,项目名称:wine_platform,代码行数:7,代码来源:PageTableSeeder.php
示例10: 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
示例11: show
/**
* Show Page.
*
* @return Response
*/
public function show($slug)
{
$page = Page::Where('slug', $slug)->first();
if (!$page) {
\App::abort(404);
}
return view('themes/basic/pages/show', ['page' => $page]);
}
开发者ID:kudosagency,项目名称:kudos-php,代码行数:13,代码来源:PagesController.php
示例12: actionShow
/**
* Shows page by it's ID
*
* @param $id
*
* @return string
* @throws \yii\web\NotFoundHttpException
*/
public function actionShow($id)
{
$page = Page::loadModel($id, false, false);
if ($page === null) {
throw new NotFoundHttpException();
}
return $this->render('show', ['model' => $page]);
}
开发者ID:pazjacket,项目名称:fiilatovnick-_-yii2-multilingual-demo,代码行数:16,代码来源:PageController.php
示例13: findModel
protected function findModel($id)
{
if (($model = Page::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
开发者ID:phucnv206,项目名称:pharma,代码行数:8,代码来源:PageController.php
示例14: index
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index($slug)
{
$page = Page::whereSlug($slug)->first();
if (empty($page)) {
die("This page was not found");
//App::abort(404);
}
return view('front.pages.show', compact('page'));
}
开发者ID:andrey-ladygin-loudclear,项目名称:skyzone-laravel,代码行数:14,代码来源:PagesController.php
示例15: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
try {
$page = Page::getPageData($this->page)->firstOrFail();
} catch (Exception $e) {
return $this->response->errorNotFound();
}
return $this->response()->item($page, new PageTransformer())->addMeta('status', 'success')->setStatusCode(200);
}
开发者ID:justincdotme,项目名称:justincdotme,代码行数:14,代码来源:PortfolioController.php
示例16: pageDelete
public function pageDelete($id)
{
try {
$page = Page::findOrFail($id);
} catch (ModelNotFoundException $e) {
return response('Page not found.', 404);
}
$page->delete();
return redirect()->route('admin.pages.static');
}
开发者ID:Comrada,项目名称:laravel-cms,代码行数:10,代码来源:AdminController.php
示例17: 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
示例18: actionDelete
/**
* @param $id
* @return \yii\web\Response
* @throws NotFoundHttpException
* @throws \Exception
*/
public function actionDelete($id)
{
/** @var Page $model */
$model = Page::findOne($id);
if (!$model) {
throw new NotFoundHttpException();
}
$model->delete();
return $this->redirect(['list']);
}
开发者ID:vetoni,项目名称:toko,代码行数:16,代码来源:PageController.php
示例19: search
/**
* Creates data provider instance with search query applied
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Page::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
$query->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'body', $this->body]);
return $dataProvider;
}
开发者ID:samatic,项目名称:yii2-starter,代码行数:15,代码来源:PageSearch.php
示例20: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Page::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'image_id' => $this->image_id]);
$query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'lang', $this->lang]);
return $dataProvider;
}
开发者ID:Sywooch,项目名称:RabotaNURE,代码行数:18,代码来源:PageSearch.php
注:本文中的app\models\Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论