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

PHP app\Topic类代码示例

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

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



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

示例1: welcome

 /**
  *
  *
  */
 public function welcome()
 {
     $topic = new \App\Topic();
     $topics = $topic->recentlyCreated();
     $categories = new \App\Categories();
     $categories = $categories->all();
     //If user then check if they have confirmed email and username
     if (Auth::user()) {
         //if email is not confirm
         if (Auth::user()->confirmed == 0) {
             return redirect('/verification');
         }
         //if displayname is not set
         if (empty(Auth::user()->displayname)) {
             return redirect()->action('ProfileController@createName');
         }
     }
     $storage = Redis::connection();
     $mostView = $storage->zRevRange('postViews', 0, 1);
     foreach ($mostView as $value) {
         $id = str_replace('post:', '', $value);
         //            echo "<br> post". $id;
     }
     return view('welcome', compact('topics', 'categories'));
 }
开发者ID:ktardthong,项目名称:qanya,代码行数:29,代码来源:HomeController.php


示例2: __construct

 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct(Topic $Topic)
 {
     $this->middleware('auth', ['except' => ['index', 'show']]);
     $this->middleware('admin', ['only' => ['edit', 'update', 'destroy']]);
     $this->Topic = $Topic;
     $this->Topics = $Topic->topics();
 }
开发者ID:jvlstudio,项目名称:3N1WebSite,代码行数:12,代码来源:TopicController.php


示例3: getTopic

 /**
  * Get Topic models Pager
  *
  * @param int $limit Per page limit
  * @return \Illuminate\Pagination\LengthAwarePaginator
  */
 public static function getTopic($limit = 15)
 {
     $Topic = new Topic();
     $Topic->builder = $Topic->query();
     $Topic->selectCategory();
     $Topic->applyFilter();
     return $Topic->builder->paginate($limit);
 }
开发者ID:jvlstudio,项目名称:3N1WebSite,代码行数:14,代码来源:Topic.php


示例4: newAppendNotify

 public function newAppendNotify(User $fromUser, Topic $topic, Append $append)
 {
     $users = $topic->replies()->with('user')->get()->lists('user');
     // Notify commented user
     Notification::batchNotify('comment_append', $fromUser, $this->removeDuplication($users), $topic, null, $append->content);
     // Notify attented users
     Notification::batchNotify('attention_append', $fromUser, $this->removeDuplication($topic->attentedBy), $topic, null, $append->content);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:8,代码来源:Notifier.php


示例5: add

 public function add()
 {
     $user = new Topic();
     $user->user_id = '123';
     $user->save();
     //$results = DB::table('topic')->get();
     // $results = Topic::create(['u_id'=>'103621']);
     // return view('m_wc.index');
 }
开发者ID:Wsmallnews,项目名称:laravel,代码行数:9,代码来源:TestController.php


示例6: __construct

 /**
  * Create a new event instance.
  *
  * @return void
  *
  * $flg -> increment or decrement
  */
 public function __construct($notify_user, $topics_uuid, $is_upvote)
 {
     $this->user = $notify_user;
     $notification = new Notification();
     $this->count = $notification->countNotification($notify_user);
     $this->is_upvote = $is_upvote;
     //Get the most upvote count*/
     $tp = new Topic();
     $this->upv_cnt = $tp->upvoteTopic($topics_uuid, $is_upvote);
     $this->topic = $topics_uuid;
 }
开发者ID:ktardthong,项目名称:qanya,代码行数:18,代码来源:TopicUpvote.php


示例7: boot

 /**
  * Register bindings in the container.
  *
  * @return void
  */
 public function boot(Guard $guard)
 {
     $topics = [];
     if ($guard->check()) {
         $topics = Topic::whereHas('followers', function ($q) use($guard) {
             $q->where('user_id', $guard->user()->id);
         })->get();
     }
     view()->composer('common.notifications', function ($view) use($topics) {
         $view->with('notifications', []);
     });
     view()->composer('posts.index', function ($view) {
         if (Input::get('order') && Input::get('order') == 'popular') {
             $order = 'popular';
         } else {
             $order = 'recent';
         }
         $view->with('order', $order);
     });
     view()->composer('posts.index', function ($view) {
         if (Input::get('view') && Input::get('view') == 'grid') {
             $v = 'grid';
         } else {
             $v = 'list';
         }
         $view->with('view', $v);
     });
 }
开发者ID:enhive,项目名称:vev,代码行数:33,代码来源:ComposerServiceProvider.php


示例8: 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


示例9: welcome

 /**
  * Show the website home page
  *
  * @return Response
  */
 public function welcome()
 {
     $topics = App\Topic::news()->orderBy('updated_at', 'desc')->limit(5)->get();
     $authme = App\Authme::with('money')->get();
     // dd($authme);
     return view('home', ['topics' => $topics, 'authme' => $authme]);
 }
开发者ID:theballkyo,项目名称:zgm-mc-web,代码行数:12,代码来源:HomeController.php


示例10: patch

 public function patch($id, Request $request)
 {
     $topic = Topic::findOrFail($id);
     $this->authorize('update-topic', $topic);
     $topic->patch($request->all());
     return response('', 200);
 }
开发者ID:mattstauffer,项目名称:suggestive,代码行数:7,代码来源:TopicsController.php


示例11: 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


示例12: topicDownVote

 public function topicDownVote(Topic $topic)
 {
     if ($topic->votes()->ByWhom(auth()->id())->WithType('downvote')->count()) {
         // click second time for remove downvote
         $topic->votes()->ByWhom(auth()->id())->WithType('downvote')->delete();
         $topic->increment('vote_count', 1);
     } elseif ($topic->votes()->ByWhom(auth()->id())->WithType('upvote')->count()) {
         // user already clicked upvote once
         $topic->votes()->ByWhom(auth()->id())->WithType('upvote')->delete();
         $topic->votes()->create(['user_id' => auth()->id(), 'is' => 'downvote']);
         $topic->decrement('vote_count', 2);
     } else {
         // click first time
         $topic->votes()->create(['user_id' => auth()->id(), 'is' => 'downvote']);
         $topic->decrement('vote_count', 1);
     }
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:17,代码来源:Voter.php


示例13: 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


示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $topics = ['Idea Generation', 'Naming', 'Domain names', 'Hosting', 'Market research', 'Forms and Surveys', 'Mockups and Wireframing', 'Design', 'Development', 'Bootcamps', 'Incubaters and Accelerators', 'Deployment', 'Social tools', 'MVP', 'Marketing', 'Early Users', 'Presentations', 'Product Demo', 'Launching', 'Analytics', 'Mobile Analytics', 'Customer Support', 'Project Management', 'Collaboration and Communication', 'Productivity', 'Bugtracking and Feedback', 'Shop', 'Payments', 'Outsourcing', 'Raising Capital', 'Investors', 'Sales', 'CRM', 'Legal', 'Finance', 'HR', 'Learning', 'Books', 'Videos', 'Articles', 'Blogs', 'Newsletters'];
     foreach ($topics as $topic) {
         $t = new Topic();
         if ($t->validate(['name' => $topic])) {
             $t->name = $topic;
             if ($t->save()) {
                 $this->command->info("Added topic: {$topic}");
             }
         } else {
             $this->command->info($t->errors());
         }
         // Topic::create(["name" => $topic]);
     }
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:22,代码来源:TopicTableSeeder.php


示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('topics')->delete();
     $topics = array(['title' => '柠檬香茅火锅仓山万达店', 'body' => '首先,服务态度真的是太好了;其次,分量非常足;然后,上菜也相当的快;最后,老板还推荐用最优惠的付款方式。', 'user_id' => 1], ['title' => '逆风网咖', 'body' => '福州第一家网咖,也是将网咖精神执行的最好的一家网咖,无烟无污染,全戴尔显示器机械键盘,请的服务生也都是学生妹。', 'user_id' => 2], ['title' => 'EmailCoffee', 'body' => '坐落正祥广场的一家咖啡管,装修风格独特,咖啡正宗,人少不吵杂,很多人都是一坐一个下午,服务生也是很漂亮。', 'user_id' => 3], ['title' => '重庆小面万达店', 'body' => '这家面馆在万达4号门,人进人出,生意很不错,味道也很好虽然有点辣', 'user_id' => 4], ['title' => '欢乐园网咖', 'body' => '福建第一家网咖连锁店,算得上常山地区真正意义上的网咖的,环境优雅,配置齐全高端', 'user_id' => 5], ['title' => '万达影院', 'body' => '每个周末都有特价电影票,偶尔遇上什么大片做特价就去看看吧,绝对是享受', 'user_id' => 6], ['title' => '高更牛排', 'body' => '一家专门做牛排西餐的店铺,价格比经典牛排优惠许多,但料一点没有减少', 'user_id' => 7], ['title' => '表哥茶餐厅', 'body' => '正宗香港品牌,致力于推广香港饮食文化,不过价格是有点偏贵', 'user_id' => 8], ['title' => '鼓岭', 'body' => '位置位于鼓山旁边,但空气比鼓山上的更清新环境比鼓山更好游客少', 'user_id' => 9]);
     foreach ($topics as $topic) {
         Topic::create($topic);
     }
 }
开发者ID:gentcys,项目名称:fzzt,代码行数:13,代码来源:TopicsTableSeeder.php


示例16: showTopic

 public function showTopic($id)
 {
     $topic = Topic::findOrFail($id);
     $replys = Reply::where('topic_id', $id)->paginate(20);
     if (!\Auth::guest() && \Auth::user()->isAdmin() || !\Auth::guest() && \Auth::user()->isMod()) {
         if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
             return view('forum.showTopic', compact('topic', 'replys'));
         } else {
             \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
             return view('forum.showTopic', compact('topic', 'replys'));
         }
     } else {
         if ($topic->forumSection->forumHead['forOrg'] == 0 && $topic->forumSection->forumHead['forBiz'] == 0) {
             if (\Auth::guest()) {
                 return view('forum.showTopic', compact('topic', 'replys'));
             }
             if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                 return view('forum.showTopic', compact('topic', 'replys'));
             } else {
                 \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                 return view('forum.showTopic', compact('topic', 'replys'));
             }
         } else {
             if (!\Auth::guest() && $topic->forumSection->forumHead['forOrg'] == \Auth::user()->queryLeaderHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forOrg'] == \Auth::user()->queryMemberHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forBiz'] == \Auth::user()->queryBmemberHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } elseif (!\Auth::guest() && $topic->forumSection->forumHead['forBiz'] == \Auth::user()->queryBleaderHeads()) {
                 if (!\Auth::guest() && \Auth::user()->queryExists($id)) {
                     return view('forum.showTopic', compact('topic', 'replys'));
                 } else {
                     \Auth::user()->readtopic()->create(['topic_id' => $id, 'was_read' => 1, 'last_read' => Carbon::now()]);
                     return view('forum.showTopic', compact('topic', 'replys'));
                 }
             } else {
                 flash()->error('Nie masz dostępu do tego tematu!');
                 return redirect('/forum');
             }
         }
     }
 }
开发者ID:AdrianKuriata,项目名称:projekt,代码行数:58,代码来源:ForumController.php


示例17: run

 public function run()
 {
     $faker = Faker::create();
     $users = User::lists('id')->all();
     $topics = Topic::lists('id')->all();
     foreach (range(1, 500) as $index) {
         factory(App\Reply::class)->create(['user_id' => $faker->randomElement($users), 'topic_id' => $faker->randomElement($topics)]);
     }
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:9,代码来源:RepliesTableSeeder.php


示例18: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $users = User::lists('id')->toArray();
     $nodes = Category::where('type_id', '=', Category::TYPE_TOPIC)->lists('id')->toArray();
     $faker = Faker\Factory::create();
     foreach (range(1, 18) as $index) {
         Topic::create(['title' => 'topic ' . $faker->sentence(), 'body' => implode('<br>', $faker->paragraphs(8)), 'user_id' => $faker->randomElement($users), 'type_id' => Topic::TYPE_TOPIC, 'category_id' => $faker->randomElement($nodes), 'last_comment_user_id' => $faker->randomElement($users)]);
     }
 }
开发者ID:jvlstudio,项目名称:3N1WebSite,代码行数:14,代码来源:TopicTableSeeder.php


示例19: store

 public function store($episodeId, Request $request)
 {
     if (!Auth::user()->isAdmin()) {
         abort(403);
     }
     $episode = Episode::findOrFail($episodeId);
     $topic = Topic::findOrFail($request->get('topic_id'));
     $episode->topics()->save($topic);
 }
开发者ID:mattstauffer,项目名称:suggestive,代码行数:9,代码来源:EpisodeScheduledTopicsController.php


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP app\User类代码示例发布时间:2022-05-23
下一篇:
PHP app\Team类代码示例发布时间: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