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


PHP Topic::where方法代码示例

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


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

示例1: index

 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     //$results = DB::table('topic')->get();
     $results = Topic::where('u_id', '103621')->get();
     print_r($results);
     return view('m_wc.index');
 }
开发者ID:Wsmallnews,项目名称:laravel,代码行数:12,代码来源:IndexController.php

示例2: indexByStatus

 private function indexByStatus($status)
 {
     $this->validateStatus($status);
     return Topic::where('status', $status)->active()->get()->map(function ($topic) {
         return new ApiTopic($topic);
     });
 }
开发者ID:mattstauffer,项目名称:suggestive,代码行数:7,代码来源:TopicsController.php

示例3: showSection

 public function showSection($nameHead, $nameSection)
 {
     $headForum = forumHead::where('link_route', $nameHead)->firstOrFail();
     $sectionForum = forumSection::where('link_section_route', $nameSection)->firstOrFail();
     $topics = Topic::where('important', 0)->latest('updated_at')->paginate(20);
     if (!\Auth::guest() && \Auth::user()->isAdmin() || !\Auth::guest() && \Auth::user()->isMod()) {
         return view('forum.showSection', compact('sectionForum', 'topics'));
     } else {
         if ($sectionForum->forumHead['forOrg'] == 0 && $sectionForum->forumHead['forBiz'] == 0) {
             return view('forum.showSection', compact('sectionForum', 'topics'));
         } else {
             if (!\Auth::guest() && $sectionForum->forumHead['forOrg'] == \Auth::user()->queryLeaderHeads()) {
                 return view('forum.showSection', compact('sectionForum', 'topics'));
             } elseif (!\Auth::guest() && $sectionForum->forumHead['forOrg'] == \Auth::user()->queryMemberHeads()) {
                 return view('forum.showSection', compact('sectionForum', 'topics'));
             } elseif (!\Auth::guest() && $sectionForum->forumHead['forBiz'] == \Auth::user()->queryBmemberHeads()) {
                 return view('forum.showSection', compact('sectionForum', 'topics'));
             } elseif (!\Auth::guest() && $sectionForum->forumHead['forBiz'] == \Auth::user()->queryBleaderHeads()) {
                 return view('forum.showSection', compact('sectionForum', 'topics'));
             } else {
                 flash()->error('Nie masz dostępu do tego działu!');
                 return redirect('/forum');
             }
         }
     }
 }
开发者ID:AdrianKuriata,项目名称:projekt,代码行数:26,代码来源:ForumController.php

示例4: storeAnswer

 public function storeAnswer($id, StoreTopicAnswerRequest $request)
 {
     \Auth::user()->reply()->create(['body' => strip_tags($request->input('reply_body'), "<b>, <u>, <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <font>, <span>, <ul>, <li>, <br>, <blockquote>, <ol>, <div>, <table>, <tbody>, <tr>, <td>, <iframe>, <a>, <img>"), 'topic_id' => $id]);
     Readtopic::where('topic_id', $id)->delete();
     Topic::where('id', $id)->update([]);
     flash()->success('Udało Ci się dodać odpowiedź do tematu!');
     return redirect('/forum/topic/' . $id . '');
 }
开发者ID:AdrianKuriata,项目名称:projekt,代码行数:8,代码来源:TopicController.php

示例5: show

 public function show($topicName, $questionNumber)
 {
     $topic = Topic::where('name', '=', $topicName)->first();
     // may needs to be refactored, may check sql queries
     $question = Question::getByTopicAndQuestionNumber($topic, $questionNumber);
     $answers = $question->answers()->get();
     $nextQuestionLink = $question->nextQuestionLink($topic, $questionNumber);
     return view('quiz.show')->with(['questionNumber' => $questionNumber, 'topic' => $topic, 'question' => $question, 'answers' => $answers, 'next' => $nextQuestionLink]);
 }
开发者ID:phpclub,项目名称:GA-Exam,代码行数:9,代码来源:QuizController.php

示例6: deleteTopic

 public function deleteTopic()
 {
     Input::merge(array_map('trim', Input::all()));
     $id = (int) Input::get('id');
     $topic = Topic::where('parent', $id);
     if (!$topic->exists()) {
         Topic::destroy($id);
     }
     return 1;
 }
开发者ID:nitin-prodigi,项目名称:mesa,代码行数:10,代码来源:TopicController.php

示例7: getOldArticles

 public function getOldArticles(Request $request)
 {
     $input = $request->get('keyword');
     $query = Topic::where('name', $input)->first();
     if ($query == null) {
         return response()->json([]);
     } else {
         return response()->json(Topic::where('name', $input)->first()->with('article')->get());
     }
 }
开发者ID:jmramos02,项目名称:somerepo,代码行数:10,代码来源:ArticleController.php

示例8: showByUnit

 public function showByUnit($code, $unit_no)
 {
     $validator = Validator::make(array('code' => $code, 'unit_no' => $unit_no), array('code' => array('regex:/(?i)[a-z]+-?[0-9]+/'), 'unit_no' => array('regex:/[0-9]+/')));
     if ($validator->fails()) {
         return response()->json(['error' => true, 'message' => $validator->messages()]);
     }
     $topic = Topic::where('subject_code', $code)->where('unit', $unit_no)->get();
     if ($topic->isEmpty()) {
         return response()->json(['error' => true, 'topic' => 'subject code or unit no is wrong!!!']);
     }
     return response()->json(['error' => false, 'topic' => $topic]);
 }
开发者ID:rohan1309,项目名称:studyhere,代码行数:12,代码来源:TopicController.php

示例9: getEnableAttribute

 function getEnableAttribute()
 {
     $enable = 0;
     $previousTopicID = Topic::where('id', '<', $this->id)->max('id');
     if (is_null($previousTopicID)) {
         $enable = 1;
     } else {
         Log::info('111 $this->id: ' . $this->id . ' $previousTopicID: ' . $previousTopicID);
         $easyKUofPreviousTopic = KnowledgeUnit::where('topic_id', '=', $previousTopicID)->where('difficulty_level', '=', '1')->pluck('id');
         $is_done_query = DB::table('users_knowledgeunits')->where('user_id', '=', Auth::user()->id)->where('knowledgeunit_id', '=', $easyKUofPreviousTopic)->first();
         if (!is_null($is_done_query)) {
             $enable = 1;
         }
     }
     return $enable;
 }
开发者ID:nouzun,项目名称:gamification,代码行数:16,代码来源:Topic.php

示例10: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
     });
     $router->bind('topics', function ($slug) {
         return Topic::where('slug', $slug)->firstOrFail();
     });
     $router->bind('users', function ($slug) {
         return User::where('username', $slug)->firstOrFail();
     });
     $router->bind('posts', function ($slug) {
         return Post::where('slug', $slug)->with(['user', 'votes', 'comments'])->firstOrFail();
     });
     $router->bind('comments', function ($id) {
         return Comment::find($id);
     });
 }
开发者ID:enhive,项目名称:vev,代码行数:24,代码来源:RouteServiceProvider.php

示例11: index

 public function index()
 {
     $pageRow = Request::input('rows', 15);
     if (Request::ajax()) {
         $data = Request::all();
         $where = array();
         if (!empty($data['title'])) {
             $where['title'] = array('like', '%' . $data['title'] . '%');
         }
         if (!empty($data['user_id'])) {
             $where['user_id'] = $data['user_id'];
         }
         if (!empty($data['admin_id'])) {
             $where['admin_id'] = $data['admin_id'];
         }
         $topic = Topic::where($where)->with('type', 'admin', 'user')->paginate($pageRow);
         $result['total'] = $topic->total();
         $result['rows'] = $topic->items();
         return response()->json($result);
     }
     return View::make('pc_cms.topic.index');
 }
开发者ID:Wsmallnews,项目名称:laravel,代码行数:22,代码来源:TopicController.php

示例12: getSameNodeTopics

 public function getSameNodeTopics($limit = 8)
 {
     return Topic::where('node_id', '=', $this->node_id)->recent()->take($limit)->get();
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:4,代码来源:Topic.php

示例13: show

 /**
  *
  */
 public function show($id)
 {
     $board = Board::find($id);
     $topics = Topic::where('board_id', '=', $id)->paginate(15);
     return view('forum.show', compact(['board', 'topics']));
 }
开发者ID:larabb,项目名称:larabb,代码行数:9,代码来源:BoardsController.php

示例14: sync_cats

 public function sync_cats($cat)
 {
     $this->topics()->sync([Topic::where('name', '=', $cat)->first()->id]);
 }
开发者ID:gitter-badger,项目名称:startupwrench,代码行数:4,代码来源:Resource.php

示例15: show

 /**
  * Show all topic in category
  *
  * @param  Request  $request
  * @param  Int      @id
  * @return Response
  */
 public function show(Request $request, $id)
 {
     $topics = App\Topic::where('category_id', $id)->orderBy('updated_at', 'desc')->get();
     $category = App\Category::all();
     return view('topic.index', ['topics' => $topics, 'category' => $category]);
 }
开发者ID:theballkyo,项目名称:zgm-mc-web,代码行数:13,代码来源:CategoryController.php


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