本文整理匯總了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'));
}
示例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();
}
示例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);
}
示例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);
}
示例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');
}
示例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;
}
示例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);
});
}
示例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');
}
示例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]);
}
示例10: patch
public function patch($id, Request $request)
{
$topic = Topic::findOrFail($id);
$this->authorize('update-topic', $topic);
$topic->patch($request->all());
return response('', 200);
}
示例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);
}
}
示例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 . '');
}
示例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]);
}
}
示例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);
}
}