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


PHP Page::save方法代码示例

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


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

示例1: 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]);
 }
开发者ID:AmilcarCondino,项目名称:Circulo_v2,代码行数:35,代码来源:PageController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|unique:pages|max:255', 'body' => 'required']);
     $page = new Page();
     $page->title = Input::get('title');
     $page->body = Input::get('body');
     $page->user_id = 1;
     //Auth::user()->id;
     if ($request->ajax()) {
         if ($page->save()) {
             return Response::json(array('success' => true, 'type' => 'create'));
         } else {
             return Response::json(array('success' => false, 'type' => 'create'));
         }
     } else {
         if ($page->save()) {
             return Redirect::to('admin');
         } else {
             return Redirect::back()->withInput()->withErrors('保存失败!');
         }
     }
     /*   Page::create(array(
              'title' => Input::get('title'),
              'body' => Input::get('body')
          ));
          return Resoponse::json(array('success' => true));*/
 }
开发者ID:dmodaii,项目名称:laravel5.1-angular,代码行数:32,代码来源:PagesController.php

示例3: postSimpan

 public function postSimpan(Request $request)
 {
     $this->validate($request, ['judul' => 'required|unique:site_pages|min:3', 'konten' => 'required']);
     $slug = str_slug($request->judul, "-");
     if ($request->hasFile('gambar')) {
         if ($request->file('gambar')->isValid()) {
             $ext = $request->file('gambar')->getClientOriginalExtension();
             $nm_gambar = str_limit($slug, 30);
             $nm_gambar = rand(11111, 99999) . "-" . $nm_gambar . "." . $ext;
             $request->file('gambar')->move(base_path() . "/resources/assets/img/page/", $nm_gambar);
         } else {
             return redirect()->route('page_tambah');
         }
     } else {
         $nm_gambar = "";
     }
     // Simpan Page
     $Page = new Page();
     $Page->judul = $request->judul;
     $Page->slug = $slug;
     $Page->konten = $request->konten;
     $Page->gambar = $nm_gambar;
     $Page->draft = $request->draft;
     $Page->id_user = $this->User->id;
     $Page->save();
     $id = $Page->id;
     $request->session()->flash('success', 'Berhasil menyimpan data');
     return redirect()->route('page_edit', [$id]);
 }
开发者ID:MediaSaktiTeam,项目名称:MS_kelautan,代码行数:29,代码来源:PageController.php

示例4: 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++;
     }
 }
开发者ID:AmilcarCondino,项目名称:Circulo_v2,代码行数:27,代码来源:Project.php

示例5: store

 public function store(Request $request)
 {
     $datos = $request->only('domain', 'page');
     $checkUrl = true;
     // by default will look for the url if exist
     //check if the domain exist
     $dominio = Domain::where('domain', $datos['domain'])->first();
     if (!$dominio) {
         $dominio = new Domain();
         $dominio->domain = $datos['domain'];
         $dominio->save();
         $checkUrl = false;
         //if the domain doesnt exist, then neither the page so i will skip the search
     }
     if ($checkUrl) {
         $page = Page::where('url', $datos['page'])->first();
         if ($page) {
             return response()->json(Page::where('domain_id', $dominio->id)->get());
         }
     }
     $user = $request->user();
     $newpage = new Page();
     $newpage->domain_id = $dominio->id;
     $newpage->url = $datos['page'];
     $newpage->created_by = $user->id;
     $newpage->save();
     return response()->json(Page::where('domain_id', $dominio->id)->get());
 }
开发者ID:antoniopacheco,项目名称:tvpage,代码行数:28,代码来源:PagesController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['title' => 'required|min:5|max:60|unique:pages']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $page = new Page();
     if ($request->sort_id > 0) {
         $page->sort_id = $request->sort_id;
     } else {
         $page->sort_id = $page->increment('sort_id', 1);
     }
     $page->title = $request->title;
     $page->slug = !empty($request->slug) ? $request->slug : str_slug($request->title);
     $page->meta_title = $request->meta_title;
     $page->meta_description = $request->meta_description;
     $page->text = $request->text;
     $page->lang = $request->lang;
     if ($request->status == 'on') {
         $page->status = 1;
     } else {
         $page->status = 0;
     }
     $page->save();
     return redirect('/admin/pages')->with('status', 'Страница добавлена!');
 }
开发者ID:AbuLoot,项目名称:unichina,代码行数:31,代码来源:AdminPagesController.php

示例7: 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.');
 }
开发者ID:scriptotek,项目名称:ub-baser,代码行数:16,代码来源:PageController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $page = new Page();
     $page->name = $request->name;
     $page->content = $request->content;
     $page->save();
     return redirect()->action('PageController@create')->with('status', 'Page Saved!');
 }
开发者ID:virtualone,项目名称:laravel5.1,代码行数:14,代码来源:PageController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(PageRequest $request)
 {
     $page = new Page($request->all());
     $page->created_by = Auth::user()->id;
     $page->modified_by = Auth::user()->id;
     $page->save();
     flash()->success('Page Created');
     return redirect('pages');
 }
开发者ID:chrismoulins,项目名称:Laravel,代码行数:14,代码来源:PageController.php

示例10: create

 public function create($data)
 {
     $page = new Page($data);
     if (!$data['parent_id']) {
         $page->parent_id = null;
     }
     $page->save();
     return $page;
 }
开发者ID:manogi,项目名称:gfw-qm,代码行数:9,代码来源:EloquentPageRepository.php

示例11: update

 public function update(PageCreateRequest $request, Page $page)
 {
     $page->name = $request->get("name");
     $page->content = $request->get("content");
     $page->parent_id = $request->get("parent_id") == 0 ? null : $request->get("parent_id");
     $page->is_menu = $request->has("is_menu") ? true : false;
     $page->is_footer = $request->has("is_footer") ? true : false;
     $page->save();
     return redirect()->route("admin.page.edit", $page->id)->with("success", trans("realestateadmin::page.edited"));
 }
开发者ID:labkod,项目名称:real-estate,代码行数:10,代码来源:PageController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $page = new Page();
     $page->name = $request->name;
     $page->slug = $request->slug;
     $page->content = $request->Description;
     $page->save();
     Activity::log('Added a new page, ' . $page->name);
     $request->session()->flash('status', 'Page was added.');
     return Redirect::action('PagesController@index');
 }
开发者ID:samyerkes,项目名称:sweet.com,代码行数:17,代码来源:PagesController.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|unique:pages|max:255', 'body' => 'required']);
     $page = new Page();
     $page->title = Input::get('title');
     $page->body = Input::get('body');
     if ($page->save()) {
         return Redirect::to('admin');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败');
     }
 }
开发者ID:jew977,项目名称:laravel5.1,代码行数:17,代码来源:PagesController.php

示例14: edit

 public function edit()
 {
     $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();
     return view('pages.admin.pages.edit', compact('page'));
 }
开发者ID:svuvis,项目名称:oshusite,代码行数:14,代码来源:PagesController.php

示例15: 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'));
 }
开发者ID:svuvis,项目名称:oshusite,代码行数:15,代码来源:PublicController.php


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