本文整理汇总了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]);
}
示例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]);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$topics = Topic::all();
return view('topic.index', compact('topics'));
}
示例9: train
public function train()
{
$topics = Topic::all();
return view('quiz.train', compact('topics'));
}
示例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'));
}
示例11: home
public function home()
{
$topics = Topic::all();
return view('pages.home', compact('topics'));
}
示例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'));
}
示例13: index
public function index()
{
//Topicsテーブルのデータをすべて取得する
$topics = Topic::all();
return view('topics.index', compact('topics'));
}
示例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