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


PHP Topic::all方法代码示例

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


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

示例1: show

 /**
  * Display a conversation and replies
  *
  * @param $slug
  * @return \Illuminate\View\View
  */
 public function show($slug)
 {
     $conversation = $this->conversationRepo->findBySlug($slug);
     $topic = Topic::all();
     $replies = $conversation->replies()->orderBy('created_at', 'DESC')->paginate(4);
     return view('Forum::Conversations.show', compact('conversation', 'replies', 'topic'));
 }
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:13,代码来源:ConversationController.php

示例2: getRandomTopic

 public function getRandomTopic()
 {
     $newarray = [];
     for ($i = 0; $i < 10; $i++) {
         $me = Topic::all()->random(1)->toarray();
         array_push($newarray, $me);
     }
     return response()->json(['error' => false, 'topic' => $newarray]);
 }
开发者ID:riteshbisht,项目名称:studyhere,代码行数:9,代码来源:RandomTopicController.php

示例3: getNew

 public function getNew()
 {
     $resource = new Resource();
     $allTopics = Topic::all()->sortBy('name');
     $topics = [];
     foreach ($allTopics as $topic) {
         $topics += [$topic->id => $topic->name];
     }
     return view('resources.new', ['topics' => $topics, 'resource' => $resource]);
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:10,代码来源:ResourceController.php

示例4: index

 public function index()
 {
     $topic = new Topic();
     $topics = Topic::all();
     //echo "<pre>";
     //$ss = $topic->GetUserinfo();
     //print_r($ss);
     //echo $topic::find(1)->user->username;
     $product = \Product::Find(['slug' => 'decorative-hedgehogs']);
     print_r($product);
     return view("index")->with('topic', $topics);
 }
开发者ID:331164885,项目名称:laravel5_blog,代码行数:12,代码来源:HomeController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $resource = Resource::find($id);
     // return var_dump($resource);
     $allTopics = Topic::all()->sortBy('name');
     $topics = [];
     foreach ($allTopics as $topic) {
         $topics += [$topic->id => $topic->name];
         if ($resource->topics->has($topic->id)) {
         }
     }
     // return view('resources.edit')->with('resource', $resource);
     return view('admin.resources.edit')->with('resource', $resource)->with('topics', $topics);
 }
开发者ID:gitter-badger,项目名称:startupwrench,代码行数:20,代码来源:ResourceController.php

示例6: getPage

 public function getPage()
 {
     // $route = $request->route();
     // $name = $route->getName();
     $page = \Request::route()->getName();
     $topics = Topic::all();
     $resources = Resource::all();
     $data = ["topics" => $topics, "resources" => $resources];
     // return $data["topics"];
     if ($page) {
         return view("admin.{$page}", $data);
     } else {
         return redirect('/admin', $data);
     }
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:15,代码来源:AdminController.php

示例7: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     $latest = Resource::where('approved', '=', true)->orderBy('created_at', 'desc')->take(42)->get();
     $topics = Topic::all()->sortBy('name');
     $wide = false;
     $featured_resources = Resource::getFeatured(5);
     $sidebar_ads['adsense'] = "<script type='text/javascript'>google_ad_client = 'ca-pub-4190828597999315'\\; google_ad_slot = '8479557582'; google_ad_width = 336; google_ad_height = 280;</script><!-- startupwrench-sidebar-top --><script type='text/javascript' src='//pagead2.googlesyndication.com/pagead/show_ads.js'></script>";
     $sidebar_ads['inmotion'] = "<a href='" . url('/go/inmotion') . "'><img src='" . url('/uploads/ih_wordpress-336x280.gif') . "' class='img-responsive'></a>";
     // $side_ads_safe = [$inmotion];
     // $side_ads_all = [$adsense, $inmotion];
     view()->share('latest', $latest);
     view()->share('topics', $topics);
     view()->share('sidebar_ads', $sidebar_ads);
     view()->share('featured_resources', $featured_resources);
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:21,代码来源:AppServiceProvider.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $topics = Topic::all();
     return view('topic.index', compact('topics'));
 }
开发者ID:soywod,项目名称:MAD,代码行数:10,代码来源:TopicController.php

示例9: train

 public function train()
 {
     $topics = Topic::all();
     return view('quiz.train', compact('topics'));
 }
开发者ID:phpclub,项目名称:GA-Exam,代码行数:5,代码来源:QuizController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $topics = Topic::all()->sortByDesc('updated_at');
     return view('topics.index', compact('topics'));
 }
开发者ID:phpclub,项目名称:GA-Exam,代码行数:10,代码来源:TopicsController.php

示例11: home

 public function home()
 {
     $topics = Topic::all();
     return view('pages.home', compact('topics'));
 }
开发者ID:gentcys,项目名称:fzzt,代码行数:5,代码来源:PagesController.php

示例12: create

 public function create()
 {
     $questions = Question::all()->groupBy('topic_id');
     $topics = Topic::all()->pluck('text', 'id')->all();
     return view('questionaire.create', compact('questions', 'topics'));
 }
开发者ID:patrick-durrer,项目名称:feedback,代码行数:6,代码来源:QuestionaireController.php

示例13: index

 public function index()
 {
     //Topicsテーブルのデータをすべて取得する
     $topics = Topic::all();
     return view('topics.index', compact('topics'));
 }
开发者ID:fumiyasac,项目名称:laravel-minimum-tutorial,代码行数:6,代码来源:TopicsController.php

示例14: search

 /**
  * @param Request $request
  *
  * @return \Illuminate\View\View
  */
 public function search(Request $request)
 {
     $conversations = $this->conversationRepo->search($request->all());
     $topic = Topic::all();
     return view('Forum::index', compact('conversations', 'topic'));
 }
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:11,代码来源:ForumController.php


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