• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Article类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update

 public function update(Article $article, Requests\CreateArticleRequest $request)
 {
     //$article = Article::findOrFail($id);
     $article->update($request->all());
     $this->syncTags($article, $request->input('tags_list'));
     return redirect('articles');
 }
开发者ID:saxum2010,项目名称:laradev,代码行数:7,代码来源:ArticlesControlles.php


示例2: destroy

 public function destroy(Article $article)
 {
     // $id から $article へ変更
     $article->delete();
     \Flash::warning('記事を削除しました。');
     return redirect()->route('articles.index');
 }
开发者ID:yokotakaoru,项目名称:international_sys,代码行数:7,代码来源:ArticlesController.php


示例3: includeAttachments

 /**
  * Include attachments.
  *
  * @param  \App\Article                  $article
  * @param  \League\Fractal\ParamBag|null $params
  * @return  \League\Fractal\Resource\Collection
  * @throws  \Exception
  */
 public function includeAttachments(Article $article, ParamBag $params = null)
 {
     $transformer = new \App\Transformers\AttachmentTransformer($params);
     $parsed = $this->getParsedParams();
     $attachments = $article->attachments()->limit($parsed['limit'])->offset($parsed['offset'])->orderBy($parsed['sort'], $parsed['order'])->get();
     return $this->collection($attachments, $transformer);
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:15,代码来源:ArticleTransformer.php


示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  ArticleRequest  $request
  * @param  Article $article
  * @return Response
  */
 public function update(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $article->tags()->sync($request->get('tag_list'));
     session()->flash('success', 'Запись ' . $request->get('title') . ' обновлена');
     return redirect()->route('article.index');
 }
开发者ID:belhard-user,项目名称:group2,代码行数:14,代码来源:BlogController.php


示例5: store

 public function store()
 {
     $article = new Article();
     $article->fill(\Input::only(['title', 'content']));
     $article->save();
     return redirect('/');
 }
开发者ID:nnanee,项目名称:pronoob,代码行数:7,代码来源:HomeController.php


示例6: save

 private function save(Article $article, array $inputs)
 {
     $article->title = $inputs['title'];
     $article->description = $inputs['description'];
     $article->image = $inputs['image'];
     $article->save();
 }
开发者ID:eddyrajomarison,项目名称:testPHP,代码行数:7,代码来源:ArticleRepository.php


示例7: create

 public function create()
 {
     //        dd(\Session::all());
     $model = new Portal();
     $portals = $model->getPortals(["parent" => 0]);
     if ($portals && is_array($portals)) {
         foreach ($portals as $portal) {
             switch ($portal->name) {
                 case '今日要闻':
                     $positions[2] = $portal->id;
                     break;
                 case '图片新闻':
                     $positions[4] = $portal->id;
                     break;
                 case '媒体报导':
                     $positions[3] = $portal->id;
                     break;
             }
             $pids[] = $portal->id;
         }
         $article_model = new Article();
         foreach ($pids as $pid) {
             $articles[$pid] = $article_model->getArticles(['Portal_id' => $pid]);
         }
         return view("index", ["portals" => $portals, 'articles' => $articles, 'positions' => $positions]);
     }
     return view("index");
 }
开发者ID:kits2code,项目名称:ignore,代码行数:28,代码来源:RootController.php


示例8: destroy

 public function destroy(Article $article)
 {
     $article->delete();
     Cache::forget('article:' . $article->id);
     Cache::forget('article:all');
     return redirect('/');
 }
开发者ID:anti-social,项目名称:vagga,代码行数:7,代码来源:ArticleController.php


示例9: update

 public function update(Article $article, ArticleRequest $request)
 {
     // $article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:mbrand12,项目名称:foundation5,代码行数:7,代码来源:ArticlesController.php


示例10: detail

 public function detail($slug, Request $request)
 {
     $slug = Input::get('slug');
     $articleModel = new Article();
     $article = $articleModel->where('slug', $slug)->firstOrFail();
     return $article;
 }
开发者ID:strever,项目名称:blog,代码行数:7,代码来源:Blog.php


示例11: destroy

 public function destroy(Article $article)
 {
     // $article = Article::findOrFail($id);
     $article->delete();
     \Session::flash('flash_message', '記事を削除しました。');
     // return redirect('articles');
     return redirect()->route('articles.index');
 }
开发者ID:akokubu,项目名称:laravel_sample,代码行数:8,代码来源:ArticlesController.php


示例12: index

 public function index()
 {
     $article = new Article();
     $article->title = 'feiyi';
     $article->content = '哈哈';
     $result = $article->save();
     var_dump($result);
 }
开发者ID:liuhai2013,项目名称:feiyi,代码行数:8,代码来源:UserController.php


示例13: postIndex

 public function postIndex(Request $request)
 {
     $article = new Article();
     $this->validate($request, ['title' => 'required', 'body' => 'required']);
     $article->fill($request->all());
     $article->save();
     return redirect('admin/create');
 }
开发者ID:jmf421,项目名称:Wikee,代码行数:8,代码来源:UserController.php


示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $Article = new Article();
     $rslist = $Article->paginate(10);
     $rslist->setPath("article");
     $pages = new BootstrapThreePresenter($rslist);
     return view("Admin/article/list")->with(["pages" => $pages, "rslist" => $rslist->toArray()]);
 }
开发者ID:such0322,项目名称:mylaravel,代码行数:13,代码来源:ArticleController.php


示例15: update

 public function update(Article $article, Requests\ArticleRequest $request)
 {
     //type hinting ArticleRequest lets us do validation
     //$article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:bartolini69,项目名称:Laracast-Tutorials,代码行数:8,代码来源:ArticlesController.php


示例16: store

 public function store()
 {
     $input = Request::all();
     // $title=Request::get('title');
     $article = new Article();
     $article->create($input);
     return redirect('articles');
 }
开发者ID:ankioza202,项目名称:laraTest5,代码行数:8,代码来源:ArticlesController.php


示例17: notify_admin

 /**
  * Send email notification about new comment
  */
 public function notify_admin(Article $article)
 {
     $view_data = ['article_url' => $article->getURL(), 'article_name' => $article->title, 'username' => $this->username, 'text' => $this->body];
     Mail::send('emails.new-comment', $view_data, function ($message) {
         $email = config('mail.from')['address'];
         $message->to($email)->subject('Новый комментарий в блоге')->from('no-replay@' . $_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME']);
     });
 }
开发者ID:al-mamun,项目名称:laravel-blog,代码行数:11,代码来源:Comment.php


示例18: store

 public function store(CreatePostRequest $request)
 {
     $request->merge(['image_header_url' => 'assets/image', 'user_id' => 1, 'slug' => Str::slug($request->input('title'))]);
     $post = new Article($request->all());
     $fileName = $post->savePicture($request->file('image'));
     $post->image_header_url = url($fileName);
     $user = User::find(1);
     return $user->articles()->save($post);
 }
开发者ID:jamesddube,项目名称:blog,代码行数:9,代码来源:ArticleController.php


示例19: article

 public function article(Request $request, Article $article)
 {
     $user = Auth::user();
     $comment = $article->comments()->create(['user_id' => $user->id, 'body' => $request->input('body')]);
     $article->update(['num_comment' => $article->comments()->count()]);
     $this->stream($comment);
     Flash::success(trans('message.articleCommentAdded'));
     return redirect()->back();
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:9,代码来源:CommentController.php


示例20: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $article = new Article();
     $article->title = $request->input('title');
     $article->content = $request->input('content');
     $article->save();
     return redirect('/articles');
 }
开发者ID:starter-boot-camp,项目名称:practice-newsapp,代码行数:15,代码来源:ArticleController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Auth类代码示例发布时间:2022-05-23
下一篇:
PHP app\App类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap