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


PHP Article::find方法代码示例

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


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

示例1: postUpdate

 public function postUpdate(Requests\Admin\ArticleRequest $request, $type, $act, $id = 0)
 {
     $article = new Article();
     if ($act == 'edit') {
         $article = Article::find($id);
     }
     $article->user_id = \Auth::id();
     $article->node_id = $request->input('node');
     $article->title = $request->input('title');
     $article->seo_title = $request->input('seo_title');
     $article->description = $request->input('description');
     $article->keywords = $request->input('keywords');
     $article->type = $request->input('type');
     $article->image = $request->input('get_image');
     $article->outline = $request->input('outline') ?: str_limit(strip_tags($request->input('content')));
     $article->content = $request->input('content');
     $article->order = $request->input('order');
     $article->views = $request->input('views');
     $article->hot = $request->input('hot') ? 1 : 0;
     $article->status = $request->input('status') ? 1 : 0;
     $article->recommend = $request->input('recommend') ? 1 : 0;
     $article->show_index = $request->input('show_index') ? 1 : 0;
     if ($article->save()) {
         $info = ['from' => 'update', 'status' => 'success'];
         j4flash($info);
         return redirect('admin/article/index/' . $type);
     } else {
         return redirect()->back()->withErrors(['err' => lang('submit failed')])->withInput();
     }
 }
开发者ID:jay4497,项目名称:j4cms,代码行数:30,代码来源:ArticleController.php

示例2: destroy

 public function destroy($id)
 {
     $article = Article::find($id);
     $article->delete();
     Flash::error('Article is deleted successfully...');
     return redirect('/admin/articles');
 }
开发者ID:cihannalp,项目名称:Laravel-Blog,代码行数:7,代码来源:ArticlesController.php

示例3: destroy

 public function destroy($id)
 {
     $article = Article::find($id);
     $article->delete();
     Flash::error('Se ha borrado el artículo ' . $article->title . ' exitosamente!');
     return redirect()->route('admin.articles.index');
 }
开发者ID:blitzkriegcoding,项目名称:blog_cf,代码行数:7,代码来源:ArticlesController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $article = Article::find($id);
     $article->delete();
     return Redirect::to('admin/articles');
 }
开发者ID:jason-gao,项目名称:xuelaravel,代码行数:13,代码来源:ArticlesController.php

示例5: search

 public function search()
 {
     $key = Input::get('key');
     $id = Article::max('id');
     for ($cnt = 1; $id > 0; $id--) {
         $article = Article::find($id);
         if (stripos($article['title'], $key) || stripos($article['text'], $key)) {
             $articles[$cnt] = $article;
             $cnt++;
         } else {
             if (stristr($article['tags'], $key)) {
                 $articles[$cnt] = $article;
                 $cnt++;
             }
         }
         if ($id == 1 && $cnt == 1) {
             $articles[$cnt] = null;
         }
     }
     foreach ($articles as $article) {
         $str = explode('__more__', $article['text']);
         $article['text'] = (string) $str[0];
     }
     //        return view('article.search', compact('articles'));
     if ($articles['1'] == null) {
         return view('errors.search_404');
     } else {
         return view('article.search', compact('articles'));
     }
     //        return $articles;
 }
开发者ID:2zH,项目名称:wind.moe,代码行数:31,代码来源:FunctionController.php

示例6: edit

 public function edit($id)
 {
     $article = Cache::rememberForever('article:' . $id, function () use($id) {
         return Article::find($id);
     });
     return view('article.edit', ['article' => $article]);
 }
开发者ID:anti-social,项目名称:vagga,代码行数:7,代码来源:ArticleController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $article = Article::find($id);
     //        dd($article);
     return view('atricles.show', compact('$article'));
 }
开发者ID:xuewindy,项目名称:anayami,代码行数:13,代码来源:ArticleController.php

示例8: store

 public function store($articleId)
 {
     $comment = Request::user()->comments()->create(['body' => Request::input('body')]);
     $article = Article::find($articleId);
     $article->comments()->save($comment);
     return redirect()->back();
 }
开发者ID:jubaedprince,项目名称:incuba_php,代码行数:7,代码来源:ArticlesCommentsController.php

示例9: 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)
 {
     $article = Article::find($id);
     dd($article);
     $article->title = $request->title;
     dd($article);
 }
开发者ID:adamkennett,项目名称:simpleCrud,代码行数:14,代码来源:ArticleController.php

示例10: updateArticle

 public function updateArticle(Request $request, $id)
 {
     $article = Article::find($id);
     $article->title = $request->input('title');
     $article->content = $request->input('content');
     $article->save();
     return response()->json($article);
 }
开发者ID:rgesit,项目名称:scrum-lollipop,代码行数:8,代码来源:ArticleController.php

示例11: updateArticle

 public function updateArticle(Request $request, $id)
 {
     $article = Article::find($id);
     $article->article_name = $request->input('article_name');
     $article->article_description = $request->input('article_description');
     $article->save();
     return response()->json($article);
 }
开发者ID:bagaswidodo,项目名称:SPA,代码行数:8,代码来源:ArticleController.php

示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $article = Article::find($id);
     if (!$article) {
         return $this->respondNotFound('Article does not exist.');
     }
     return $this->respond(['data' => $this->articleTransformer->transform($article)]);
 }
开发者ID:rankarpan,项目名称:laravel-user-timezone,代码行数:14,代码来源:ArticleController.php

示例13: view

 public function view($id)
 {
     //funcion helper que nos trae Laravel
     $article = Article::find($id);
     //dd($article);
     //Retornamos a la valores a la vista que se encuentra en la carpeta test de view.
     return view('test.index', ['article' => $article]);
 }
开发者ID:ferch01991,项目名称:BlogLaravel,代码行数:8,代码来源:TestController.php

示例14: view

 public function view($id)
 {
     $article = Article::find($id);
     $article->category;
     $article->user;
     $article->tags;
     return view('test.index', ['prueba' => $article]);
 }
开发者ID:bravosan,项目名称:blog,代码行数:8,代码来源:TestController.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $article = Article::find($request->route()->parameter('articles'));
     if (!$article || !can_manage_article($article)) {
         return redirect('/');
     }
     return $next($request);
 }
开发者ID:absent1706,项目名称:laravel-minihabr,代码行数:15,代码来源:AbortIfCantManageArticle.php


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