本文整理汇总了PHP中app\models\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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";
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例5: destroy
public function destroy($id)
{
$page = Page::find($id);
//$page->delete();
Notification::success('The page was deleted.');
return Redirect::route('admin.pages.index');
}
示例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]);
}
}
示例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));
}
示例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]);
}
示例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]);
}
}
示例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]);
}
示例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]);
}
示例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]);
}
示例13: findModel
protected function findModel($id)
{
if (($model = Page::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
示例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'));
}
示例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);
}