本文整理汇总了PHP中Content::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::all方法的具体用法?PHP Content::all怎么用?PHP Content::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
// Generate groups sitemap
$sitemap = App::make("sitemap");
$x = 1;
foreach (Group::all() as $group) {
$sitemap->add(URL::to(route('group_contents', $group->getKey())), null, '1.0', 'daily');
$sitemap->add(URL::to(route('group_contents_new', $group->getKey())), null, '1.0', 'daily');
$sitemap->add(URL::to(route('group_entries', $group->getKey())), null, '1.0', 'daily');
if (!($x % 100)) {
$this->info($x . ' groups processed');
}
$x++;
}
$this->info('All groups processed');
$sitemap->store('xml', 'sitemap-groups');
unset($sitemap);
// Generate entries sitemap
$sitemap = App::make("sitemap");
$x = 1;
foreach (Content::all() as $content) {
$route = route('content_comments_slug', [$content->getKey(), Str::slug($content->title)]);
$sitemap->add(URL::to($route), $content->modified_at, '1.0', 'daily');
if (!($x % 100)) {
$this->info($x . ' contents processed');
}
$x++;
}
$this->info('All contents processed');
$sitemap->store('xml', 'sitemap-contents');
unset($sitemap);
// Generate contents sitemap
$sitemap = App::make("sitemap");
$x = 1;
foreach (Entry::all() as $entry) {
$route = route('single_entry', $entry->getKey());
$sitemap->add(URL::to($route), $entry->modified_at, '1.0', 'daily');
if (!($x % 100)) {
$this->info($x . ' entries processed');
}
$x++;
}
$this->info('All entries processed');
$sitemap->store('xml', 'sitemap-entries');
unset($sitemap);
// Generate global sitemap
$sitemap = App::make("sitemap");
$sitemap->addSitemap(URL::to('sitemap-groups.xml'));
$sitemap->addSitemap(URL::to('sitemap-contents.xml'));
$sitemap->addSitemap(URL::to('sitemap-entries.xml'));
$sitemap->store('sitemapindex', 'sitemap');
}
示例2: index
function index($params)
{
$number_of_posts = get_option('number_of_posts', $params['id']);
if ($number_of_posts == false) {
$number_of_posts = 5;
}
$number_of_posts = (int) $number_of_posts;
//d($number_of_posts);
//$posts = \Content::where('id', '!=',0)->take(intval($number_of_posts))->get()->toArray();
//$posts = \Content::items()->take($number_of_posts)->get()->toArray();
// d(\DB::getQueryLog());
$posts = \Content::all()->take($number_of_posts);
// $posts = \Content::take($number_of_posts)->get();
//d($posts);
//$view = \View::make('mvc_example_blade::index')->withPosts($posts)->render();
// dd($posts);
// $view = \View::make('mvc_example_blade::index')->with('posts', $posts)->render();
$view = \View::make('mvc_example_blade::index')->with('posts', $posts);
// print $view;
return $view;
// print $view;
//
// print 11111111;
}
示例3: all
public function all()
{
return Content::all();
}
示例4: indexContentEdit
public function indexContentEdit()
{
$contents = Content::all();
return View::make('admin.contentedit.index')->withContents($contents);
}
示例5: contents
public function contents()
{
return View::make('content.content-list')->withContents(Content::all());
}