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


PHP Tag::findOrFail方法代码示例

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


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

示例1: destroy

 public function destroy($id, EditTag $request)
 {
     $tag = Tag::findOrFail($id);
     $tag->delete();
     \Session::flash('flash_message', 'Tag został usunięty!');
     return redirect('/admin/tags');
 }
开发者ID:Zlyy,项目名称:adceg,代码行数:7,代码来源:TagsController.php

示例2: 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)
 {
     $this->validate($request, ['name' => 'required|min:2']);
     TagModel::findOrFail($id)->update($request->all());
     \Session::flash('status', 'The tag has been updated successfully');
     return redirect()->action('Tag@edit', $id);
 }
开发者ID:no-global-state,项目名称:Mabbit,代码行数:14,代码来源:Tag.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(TagRequest $request, $id)
 {
     $tag = Tag::findOrFail($id);
     $tag->update($request->all());
     flash('Tag has been updated');
     return Redirect::back();
 }
开发者ID:jentleyow,项目名称:pcf,代码行数:14,代码来源:TagsController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\TagRequest $request, $id)
 {
     $tag = Tag::findOrFail($id);
     $input = $request->all();
     $tag->update($input);
     return redirect()->action('Goenitz\\TagController@index');
 }
开发者ID:tianyirenjian,项目名称:laravel-blog,代码行数:14,代码来源:TagController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     $tag = Tag::findOrFail($id);
     $tag->update($request->all());
     return redirect('tag');
 }
开发者ID:abhatia2107,项目名称:cat,代码行数:13,代码来源:TagController.php

示例6: destroy

 public function destroy($id)
 {
     //
     $tag = Tag::findOrFail($id);
     $tag->delete();
     return redirect('/admin/tag')->withSuccess("The '{$tag->tag}' tag has been deleted.");
 }
开发者ID:edom-huang,项目名称:personalBlog,代码行数:7,代码来源:TagController.php

示例7: showProductByTag

 /**
  * Display a listing of products by each tag
  *
  * @param $id
  * @param string $slug
  */
 public function showProductByTag($id, $slug = '')
 {
     $tag = Tag::findOrFail($id);
     $products = $tag->products()->with('category', 'picture')->paginate($this->paginate);
     $title = "Tag {$tag->name}";
     return view('front.tag', compact('products', 'tag', 'title'));
 }
开发者ID:yinilauriot,项目名称:StarWars,代码行数:13,代码来源:FrontController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $tag = Tag::findOrFail($id);
     $this->authorize('update-destroy', $tag);
     $tag->delete();
     return $tag;
 }
开发者ID:nickdunn2,项目名称:bocket,代码行数:13,代码来源:TagsController.php

示例9: update

 public function update(Request $request, $id)
 {
     $tag = Tag::findOrFail($id);
     $tag->name = $request->name;
     $tag->slug = $request->slug;
     $tag->save();
 }
开发者ID:BobbyHoltzner,项目名称:BH2016,代码行数:7,代码来源:TagController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $tag = Tag::findOrFail($id);
     $tag->articles()->detach();
     $tag->delete();
     return redirect('/');
 }
开发者ID:xiaoterry,项目名称:blog,代码行数:13,代码来源:TagController.php

示例11: testTagPostRelationship

 /**
  * Test Tag -> Post relationship
  *
  * @return void
  */
 public function testTagPostRelationship()
 {
     $this->assertTrue(Tag::findOrFail(1) instanceof Tag);
     $relationshipCollection = Tag::find(1)->posts()->get();
     $collection = collect([]);
     $this->assertTrue($relationshipCollection instanceof $collection);
 }
开发者ID:joaumg-deprecated,项目名称:joaumg_com,代码行数:12,代码来源:RelationshipsTest.php

示例12: tag

 public function tag($id)
 {
     $categories = $this->categories();
     $articles = Tag::findOrFail($id)->articles()->orderBy('id', 'desc')->paginate(10);
     $tag = Tag::findOrFail($id);
     return view('home.tag', compact('categories', 'tag', 'articles'));
 }
开发者ID:hushibing,项目名称:laravel51,代码行数:7,代码来源:HomeController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @param \App\Http\Requests\FilterArticlesRequest $request
  * @param int|null                                 $id
  * @return \Illuminate\Http\Response
  */
 public function index(FilterArticlesRequest $request, $id = null)
 {
     $query = $id ? Tag::findOrFail($id)->articles() : new Article();
     // If you are relying on 'file' or 'database' cache, cacheTags() methods is not available
     $query = taggable() ? $query->with('comments', 'author', 'tags', 'attachments')->remember(5)->cacheTags('articles') : $query->with('comments', 'author', 'tags', 'solution', 'attachments')->remember(5);
     $articles = $this->filter($request, $query)->paginate(10);
     return view('articles.index', compact('articles'));
 }
开发者ID:mwasa,项目名称:l5essential,代码行数:15,代码来源:ArticlesController.php

示例14: articlesbytag

 public function articlesbytag($id)
 {
     $choosenLang = \Session::get('locale');
     $tags = Tag::where('lang', '=', $choosenLang)->get();
     $tag = Tag::findOrFail($id);
     $articles = $tag->articles()->paginate(2);
     return view('index', compact('articles', 'tags'));
 }
开发者ID:ramigit3D,项目名称:article,代码行数:8,代码来源:HomeController.php

示例15: tag

 public function tag($tagid)
 {
     $tag = Tag::findOrFail($tagid);
     if (!$tag->articles->isEmpty()) {
         $articles = $tag->articles;
         return view('pages.articles.articles', compact('articles'));
     }
     return Redirect::to("/articles");
 }
开发者ID:Cih2001,项目名称:hamidreza,代码行数:9,代码来源:ArticlesController.php


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