本文整理汇总了PHP中app\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moduleAndPageCreate
public function moduleAndPageCreate($request)
{
$projectID = Project::orderBy('id', 'desc')->first();
$modules = $request->projected_total_modules;
$m = 1;
$pages = $request->projected_total_pages / $request->projected_total_modules;
$p = 1;
$pageNumber = 1;
while ($m <= $modules) {
$newModule = new Module();
$newModule->project_id = $projectID->id;
$newModule->name = 'Modulo' . $m;
$newModule->projected_total_pages = $pages;
$newModule->save();
$p = 1;
while ($p <= $pages) {
$moduleID = Module::orderBy('id', 'desc')->first();
$newPage = new Page();
$newPage->module_id = $moduleID->id;
$newPage->name = $pageNumber;
$newPage->save();
$p++;
$pageNumber++;
}
$m++;
}
}
示例2: showPage
/**
* @param \App\Page $page
*/
public function showPage(\App\Page $page)
{
if (!$page->isPublished()) {
abort(404);
}
return view('page', ['page_title' => $page->title, 'page_content' => $page->content]);
}
示例3: index
public function index(Page $page, PhotogalleriesGallery $photogalleriesGallery, Banner $banner, Service $service)
{
$about = $page->geByTitle('about');
$banners = $banner->getByWeight();
$services = $service->getOnTop();
$gallery = $photogalleriesGallery->random();
return view('index', ['banners' => $banners, 'services' => $services, 'about' => $about[0], 'gallery' => $gallery]);
}
示例4: destroy
public function destroy(Page $page)
{
if ($page->image && \File::exists(public_path() . "/" . $page->image)) {
\File::delete(public_path() . "/" . $page->image);
}
$page->delete();
return redirect()->route("backend.page.index");
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Page $page
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Page $page)
{
$this->authorize($page->permission);
$page->body = $request->body;
$page->updated_by = $request->user()->id;
$page->save();
return redirect()->route($page->name)->with('status', 'Siden ble lagret.');
}
示例6: create
public function create($data)
{
$page = new Page($data);
if (!$data['parent_id']) {
$page->parent_id = null;
}
$page->save();
return $page;
}
示例7: destroy
public function destroy(Page $page)
{
if (\Request::has('id')) {
Page::destroy(\Request::input('id'));
return ['result' => true];
}
$page->delete();
return redirect('dash/page')->with('message', 'Page was delete success.');
}
示例8: update
public function update(Requests\Pages\EditPageRequest $request, $id, StoreFile $storeFile, \App\Page $page)
{
if ($request->hasFile('image')) {
$image_path = $storeFile->move($request->file('image'), 'images/pages/', 16);
$modified_request = array_merge($request->all(), ['image' => $image_path]);
} else {
$modified_request = $request->except('image');
}
$page->findOrFail($id)->update($modified_request);
//Redirect
return redirect()->action('Panel\\PagesController@index');
}
示例9: post_year
public function post_year($year)
{
// возвращаем посты за year
# обращаемся к моделе Category
$Categories = new Categories();
$categories = $Categories->cats_for_header();
# обращаемся к моделе Page
$pages = new Page();
$footer_pages = $pages->footer_pages();
$Posts_model = new Posts();
$posts = $Posts_model->post_of_year($year);
return view('layouts.default', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
}
示例10: Page
function __construct()
{
$page = new Page();
// Check if it has some uri
if ($uri = $page->getUri()) {
return $page->redirectTo($uri);
}
// Check if it's a post request
if ($_POST) {
$input = $page->inputValidate($_POST);
$page->url_obj->store($input);
}
$page->renderPage('default');
}
示例11: index
public function index()
{
# обращаемся к моделе Category
$vrode_model = new Categories();
$categories = $vrode_model->cats_for_header();
# обращаемся к моделе Page
$pages = new Page();
$footer_pages = $pages->footer_pages();
//Получение разбитого на страницы запроса из базы данных:
$postsi = new Posts();
$per_page = 10;
$posts = $postsi->post_paginate($per_page);
return view('layouts.default', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
}
示例12: oshu
public function oshu()
{
$page = Page::where('slug', 'oshu')->first();
if ($page == null) {
$new = new Page();
$new->slug = 'oshu';
$new->nav_title = 'OSHU - Wat doen we?';
$new->title = 'test';
$new->body = 'test';
$new->save();
}
$page = Page::where('slug', 'oshu')->first();
$examples = Example::all();
return view('pages.public.oshu', compact('page', 'examples'));
}
示例13: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$pages = Page::all();
$cities = City::all();
view()->share('pages', $pages);
view()->share('cities', $cities);
}
示例14: update
public function update(Request $request)
{
$input = $request->all();
$page = Page::find(1);
$page->update(['user_id' => Auth::user()->id, 'is_active' => 1, 'meta_title' => $input['meta_title'], 'meta_desc' => $input['meta_desc'], 'title_h1' => $input['title_h1'], 'title_h2' => $input['title_h2'], 'desc' => $input['desc'], 'content' => $input['content'], 'sender' => $input['sender']]);
$page->cover->update(['name' => $input['background_image_name'], 'url' => 'cover']);
if (isset($input['background_image'])) {
$file = base_path() . '/public/assets/images/about/cover.jpg';
$img = Image::make($input['background_image']);
$img->save($file);
}
foreach ($page->pictures as $key => $pic) {
if (isset($input['about_image_name_' . $key])) {
$pic->picture->name = $input['about_image_name_' . $key];
$pic->picture->save();
}
if (isset($input['about_image_' . $key])) {
$unique_name = md5(microtime());
$file = base_path() . '/public/assets/images/about/' . $unique_name . '.jpg';
$img = Image::make($input['about_image_' . $key]);
$img->save($file);
$pic->picture->url = $unique_name;
$pic->picture->save();
}
}
return redirect()->route('about');
}
示例15: 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);
}