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


PHP Page::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'content' => 'required', 'page_type' => 'required', 'state' => 'required']);
     $data = $request->all();
     $data['publish_at'] = date('Y-m-d H:i:s', strtotime($data['publish_at']));
     unset($data['_token']);
     $page = $this->page->create($data);
     return redirect()->route('pages.show', $page->id);
 }
开发者ID:jimmitjoo,项目名称:laraj,代码行数:13,代码来源:PagesController.php

示例2: store

 public function store(Request $request)
 {
     $this->validate($request, ['id' => 'required']);
     Page::create($request->all());
     $request->flash();
     return redirect("/admin/pages");
 }
开发者ID:AlexKomrakov,项目名称:czo,代码行数:7,代码来源:PagesController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PageRequest $request)
 {
     //
     $input = $request->all();
     Page::create($input);
     return redirect('paginas');
 }
开发者ID:AmilcarCondino,项目名称:circulo,代码行数:13,代码来源:PagesController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     \App\Page::create(['user_id' => 1, 'slug' => 'home', 'route' => 'home', 'status' => 1]);
     \App\Page::create(['user_id' => 1, 'slug' => 'about', 'route' => 'about', 'status' => 1]);
     \App\Page::create(['user_id' => 1, 'slug' => 'contact', 'route' => 'contact', 'status' => 1]);
 }
开发者ID:borislemke,项目名称:kbr,代码行数:12,代码来源:PagesTableSeeder.php

示例5: run

 public function run()
 {
     DB::table('pages')->delete();
     Page::create(['name' => 'News Items', 'alias' => 'news', 'description' => 'News you can use.', 'created_by' => 1, 'modified_by' => 1]);
     Page::create(['name' => 'Pop Culture', 'alias' => 'popCulture', 'description' => 'Celebrities, and stuff.', 'created_by' => 1, 'modified_by' => 1]);
     Page::create(['name' => 'Food Blog', 'alias' => 'food', 'description' => 'Getting hungry yet?', 'created_by' => 1, 'modified_by' => 1]);
 }
开发者ID:chrismoulins,项目名称:Laravel,代码行数:7,代码来源:DatabaseSeeder.php

示例6: 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:jiangzhonghui,项目名称:Learn-Laravel-5,代码行数:7,代码来源:PageTableSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required']);
     $item = Page::create($request->all());
     Flash::success("Запись - {$item->id} сохранена");
     return redirect(route('admin.pages.index'));
 }
开发者ID:jambik,项目名称:sellmecar,代码行数:13,代码来源:PagesController.php

示例8: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     $token = str_random(32);
     $inputs = $request->all();
     $userId = Auth::user()->id;
     $vacancy = Page::where('userId', '=', $userId, 'and', 'status', '=', '1')->get();
     if (count($vacancy)) {
         Page::create(['userId' => $userId, 'title' => $inputs['title'], 'content' => $inputs['content'], 'email' => $inputs['email'], 'status' => 1, 'token' => $token]);
         return redirect('/')->with('message', 'Вакансия создана');
     } else {
         $text = 'Спасибо за размещение, в данный момент вакансия на модерации.';
         Mail::raw($text, function ($message) {
             $userEmail = Auth::user()->email;
             $message->from('laravel@example.com', 'Laravel');
             $message->to($userEmail);
         });
         Page::create(['userId' => $userId, 'title' => $inputs['title'], 'content' => $inputs['content'], 'email' => $inputs['email'], 'status' => 0, 'token' => $token]);
         Mail::send('emails.template', ['token' => $token, 'title' => $inputs['title'], 'content' => $inputs['content']], function ($message) {
             $userEmail = User::where('user_type', '=', 'admin')->first();
             $message->from('laravel@example.com', 'Laravel');
             $message->to($userEmail->email);
         });
         return redirect('/')->with('message', 'Проверьте почту');
     }
 }
开发者ID:AlexandrGitHub,项目名称:test,代码行数:30,代码来源:CreateItemController.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('pages')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['title', 'text'], $this->items[$i]);
         Page::create($row);
     }
 }
开发者ID:jambik,项目名称:sellmecar,代码行数:13,代码来源:PagesTableSeeder.php

示例10: storepage

 public function storepage()
 {
     if (Page::create(Input::all())) {
         return Redirect::to('admin/page_publish')->withErrors(Null);
     } else {
         return Redirect::back()->withInput()->withErrors('page store fail!');
     }
 }
开发者ID:luowc302,项目名称:SelfProject,代码行数:8,代码来源:PageController.php

示例11: store

 /**
  * Store a newly created page in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ["name" => "required", "slug" => "required|unique:page", "enabled" => "required|accepted"]);
     $input = $request->input();
     $input["user_id"] = $request->user()->id;
     Page::create($input);
     return redirect()->action("PanelController@edit", $input["slug"]);
 }
开发者ID:Want100Cookies,项目名称:monster-cms,代码行数:14,代码来源:PanelController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'content' => 'required']);
     $input = $request->all();
     Page::create($input);
     Session::flash('flash_message', 'Stránka vytvořena.');
     return redirect()->route('pages.index');
 }
开发者ID:jZejda,项目名称:oplanManager,代码行数:14,代码来源:PagesController.php

示例13: 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]);
     }
     DB::table('users')->delete();
     User::create(['name' => 'admin@aneng.com', 'email' => 'admin@aneng.com ', 'password' => bcrypt('000000')]);
 }
开发者ID:ccq18,项目名称:anneng,代码行数:9,代码来源:PageTableSeeder.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $this->validate($request, $this->rules);
     $request['user_id'] = $request->user()->id;
     $input = Input::all();
     Page::create($input);
     return Redirect::route('superadmin.pages.index')->with('message', 'Page created');
 }
开发者ID:JRizzle88,项目名称:wewillcode,代码行数:15,代码来源:PagesController.php

示例15: edit

 public function edit(Request $request)
 {
     $page_menu_position = [Page::HEADER_MENU => trans('admin_common.Header Menu'), Page::FOOTER_MENU => trans('admin_common.Footer Menu')];
     $id = 0;
     if (isset($request->id)) {
         $id = $request->id;
     }
     $modelData = new \stdClass();
     if ($id > 0) {
         try {
             $modelData = Page::findOrFail($id);
         } catch (ModelNotFoundException $e) {
             session()->flash('message', trans('admin_common.Invalid Page'));
             return redirect(url('admin/page'));
         }
     }
     /**
      * form is submitted check values and save if needed
      */
     if ($request->isMethod('post')) {
         /**
          * validate data
          */
         $rules = ['page_position' => 'required|integer|not_in:0', 'page_slug' => 'required|max:255|unique:page,page_slug', 'page_title' => 'required|max:255', 'page_content' => 'required', 'page_ord' => 'required|integer'];
         if (isset($modelData->page_id)) {
             $rules['page_slug'] = 'required|max:255|unique:page,page_slug,' . $modelData->page_id . ',page_id';
         }
         $validator = Validator::make($request->all(), $rules);
         if ($validator->fails()) {
             $this->throwValidationException($request, $validator);
         }
         /**
          * get data from form
          */
         $data = $request->all();
         if (isset($data['page_active'])) {
             $data['page_active'] = 1;
         } else {
             $data['page_active'] = 0;
         }
         /**
          * save or update
          */
         if (!isset($modelData->page_id)) {
             Page::create($data);
         } else {
             $modelData->update($data);
         }
         /**
          * clear cache, set message, redirect to list
          */
         Cache::flush();
         session()->flash('message', trans('admin_common.Page saved'));
         return redirect(url('admin/page'));
     }
     return view('admin.page.page_edit', ['modelData' => $modelData, 'page_menu_position' => $page_menu_position]);
 }
开发者ID:gdinko,项目名称:dclassifieds.laravel,代码行数:57,代码来源:PageController.php


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