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


PHP Page::find方法代码示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\UpdatePageRequest $request, $id)
 {
     $page = Page::find($id);
     $page->update($request->all());
     $page->save();
     return redirect('admin/page/1/edit')->with('message', 'გვერდი განახლებულია');
 }
开发者ID:erekle1,项目名称:mytest,代码行数:14,代码来源:PageController.php

示例2: show

 public function show($id)
 {
     $data['project'] = Publish::find($id);
     $data['url_cv'] = Page::find(1)->sender;
     $data['projects'] = Publish::where('type', 'article')->orderBy('updated_at', 'DESC')->take(3)->get();
     return view('project', $data);
 }
开发者ID:antoinemy,项目名称:folio-old,代码行数:7,代码来源:ProjectController.php

示例3: updatePage

 /**
  * @param Request $request
  * @param $id
  * @return mixed
  */
 private function updatePage(Request $request, $id)
 {
     $this->validate($request, ['title' => 'required', 'content' => 'required', 'page_type' => 'required', 'state' => 'required']);
     $page = $this->page->find($id);
     $page->update($request->all());
     return $page;
 }
开发者ID:jimmitjoo,项目名称:laraj,代码行数:12,代码来源:PagesController.php

示例4: save

 /**
  * Save page
  * 
  * @return \Illuminate\Http\JsonResponse
  */
 public function save()
 {
     $input = \Input::except('_token');
     $input['name'] = strtolower($input['name']);
     $validator = \Validator::make($input, ['name' => 'required|alpha_dash|max:255|unique:pages' . (!empty($input['id']) ? ',name,' . $input['id'] : ''), 'route' => 'required|unique:pages' . (!empty($input['id']) ? ',route,' . $input['id'] : '')]);
     // When fails
     if ($validator->fails()) {
         return response()->json(['errors' => $validator->messages()]);
     }
     // Fix php tag in data
     if (strpos($input['data'], '<?php') !== 0) {
         $input['data'] = '<?php ' . str_replace('<?php', '', $input['data']);
     }
     // Save changes
     $page = empty($input['id']) ? new Page() : Page::find($input['id']);
     $page->fill($input);
     $page->save();
     try {
         // Do not overwrite existing view file
         if (!empty($input['id']) || empty($input['id']) && !file_exists($page->getViewPath())) {
             file_put_contents($page->getViewPath(), $input['content']);
         }
         file_put_contents($page->getDataPath(), $input['data']);
         // Response
         return response()->json(['success' => 'Settings saved', 'redirect' => url('/admin/pages/list')]);
     } catch (\ErrorException $e) {
         return response()->json(['success' => false, 'errors' => ['permissions' => [$e->getMessage()]]]);
     }
 }
开发者ID:dookda,项目名称:mapigniter2,代码行数:34,代码来源:PageController.php

示例5: 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');
 }
开发者ID:antoinemy,项目名称:folio-old,代码行数:27,代码来源:AboutController.php

示例6: parentPath

 public function parentPath()
 {
     if (!$this->parent_id) {
         return false;
     }
     $parent = \App\Page::find($this->parent_id)->first();
     return $parent->path;
 }
开发者ID:stjanilofts,项目名称:df,代码行数:8,代码来源:Page.php

示例7: updateContact

 public function updateContact(Request $request)
 {
     $params = $request->input();
     $page = Page::find(2);
     $page->text = $params['text'];
     $page->save();
     return redirect()->action('HomeController@contact');
 }
开发者ID:jclancy93,项目名称:artmarket,代码行数:8,代码来源:HomeController.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $page = Page::find($id);
     $page->title = $request->input('title');
     $page->body = $request->input('body');
     $page->slug = $request->input('slug');
     $page->save();
     return redirect()->route('page.show', [$page->slug]);
 }
开发者ID:edrobotij,项目名称:league,代码行数:16,代码来源:PageController.php

示例9: update

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

示例10: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $page = Page::find(1);
     $news = News::find($id);
     if ($news->types == 'news') {
         return view('newsDetail')->with(['page' => $page, 'news' => $news]);
     } elseif ($news->types == 'development') {
         return view('developmentDetail')->with(['page' => $page, 'news' => $news]);
     }
 }
开发者ID:klokand,项目名称:JulySite,代码行数:16,代码来源:NewsController.php

示例11: about

 public function about()
 {
     // // foreach($user as $users){
     // // 	echo 'Name ==>' . $users->name. '<br/>';
     // // 	echo 'Email ==>' . $users->email. '<br/>';
     // // }
     // $user = DB::table('users')->where('name','wesarut')->first();
     // echo 'Name ==> ';
     // echo count($user->name) == '1' ? $user->name : 'error';
     $user = Page::find(5);
     return view('page.about', ['qqq' => $user]);
 }
开发者ID:anubissmile,项目名称:laravel_tut,代码行数:12,代码来源:PageController.php

示例12: update

 public function update(Request $request)
 {
     $input = $request->all();
     $page = Page::find(4);
     $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'], '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/contact/cover.jpg';
         $img = Image::make($input['background_image']);
         $img->save($file);
     }
     return redirect()->route('contact_admin');
 }
开发者ID:antoinemy,项目名称:folio-old,代码行数:13,代码来源:ContactController.php

示例13: show

 public function show($id)
 {
     $user = Page::findOrFail($id);
     $user_id = $user->user_id;
     $page = Page::find($id);
     $comment = $page->hasManyComments()->paginate(3);
     if ($user->count() == 0) {
         return view('index.content', ['name' => Null])->withPage(Null)->withErrors('Not found!')->withComments(Null);
     } else {
         $user = User::find($user_id)->name;
         return view('index.content', ['name' => $user])->withPage($page)->withErrors(Null)->withComments($comment);
     }
 }
开发者ID:luowc302,项目名称:SelfProject,代码行数:13,代码来源:PageController.php

示例14: update

 public function update(Requests\PageRequest $request)
 {
     $input = Request::all();
     $page = Page::find($input['id']);
     $page->body = $input['body'];
     $page->title = $input['title'];
     $page->slug = $input['slug'];
     $page->save();
     // Log Update in Activity Table
     Activity::log(['contentId' => $page->id, 'contentType' => 'Page', 'action' => 'Update', 'description' => 'Update a Page', 'details' => \Auth::user()->id, 'updated' => '']);
     // Set Flash Message
     session()->flash('flash_message', '' . $page->title . ' Updated!');
     return redirect('pages/' . $page->slug . '');
 }
开发者ID:Gadurp1,项目名称:KD-2,代码行数:14,代码来源:PagesController.php

示例15: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['title' => 'required|unique:pages,title,' . $id . '|max:255', 'body' => 'required']);
     $page = Page::find($id);
     $page->title = Input::get('title');
     $page->body = Input::get('body');
     $page->user_id = 1;
     //Auth::user()->id;
     if ($page->save()) {
         return Redirect::to('admin');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }
开发者ID:dmodaii,项目名称:laravel5.1-angular,代码行数:20,代码来源:PagesController.php


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