當前位置: 首頁>>代碼示例>>PHP>>正文


PHP app\Topic類代碼示例

本文整理匯總了PHP中app\Topic的典型用法代碼示例。如果您正苦於以下問題:PHP Topic類的具體用法?PHP Topic怎麽用?PHP Topic使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Topic類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的app\Topic類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。