本文整理汇总了PHP中app\Page::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::all方法的具体用法?PHP Page::all怎么用?PHP Page::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$pagesAll = Page::all();
$articlesAll = Article::all();
$templatesAll = Template::all();
$contentAreasAll = ContentArea::all();
$content_areas = ContentArea::lists('name', 'id');
$pages = Page::lists('name', 'id');
$article = Article::findOrFail($id);
return view('site.edit', compact('article', 'pages', 'content_areas', 'pagesAll', 'articlesAll', 'templatesAll', 'contentAreasAll'));
}
示例2: index
public function index()
{
$pages = Page::all();
$landing = Landing::where('lang', \App::getLocale())->first();
$universities = University::where('lang', \App::getLocale())->take(9)->get();
return view('pages.index', ['pages' => $pages, 'landing' => $landing, 'universities' => $universities]);
}
示例3: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$pages = Page::all();
$cities = City::all();
view()->share('pages', $pages);
view()->share('cities', $cities);
}
示例4: index
public function index()
{
// echo Str::slug('test stasd', '_');
if (\Request::ajax()) {
return Page::all();
}
return view('page.index');
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// return view('Admin')->withPages(Page::all());
// return view('Admin',['pages'=>Page::all()]);
return view('Admin')->with('pages', Page::all())->with('articles', Article::all());
// $pages['pages'] = Page::all();
// return view('Admin',$pages);
}
示例6: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view()->composer('_footer', function ($view) {
$view->with('pages', \App\Page::all());
});
view()->composer('errors.404', function ($view) {
$view->with('products', \App\Product::paginate(12));
});
}
示例7: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
//return view('home');
/*$page = Page::findOrFail(12);
print_r($page);
exit();*/
//echo storage_path();
return view('adminHome')->withPages(Page::all());
}
示例8: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
});
foreach (Page::all() as $page) {
$router->get($page->uri, ['as' => $page->name, function () use($page, $router) {
return $this->app->call('App\\Http\\Controllers\\PageController@show', ['page' => $page, 'parameters' => $router->current()->parameters()]);
}]);
}
}
示例9: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
if (Schema::hasTable('sections')) {
$sections = Section::all();
$pages = Page::all();
$pagesNew = [];
$sectionsNew = [];
view()->share(['sections' => $sections, 'pages' => $pages, 'sectionsNew' => $sectionsNew, 'pagesNew' => $pagesNew]);
}
}
示例10: show
public function show($slug)
{
$paths = array_filter(explode('/', $slug));
$count = count($paths);
foreach ($paths as $k => $slug) {
$k++;
$_p = \App\Page::where('slug', $slug)->first();
if (!$_p) {
$pages = \App\Page::all();
/*foreach($pages as $page) {
if($page->translations(lang())->has('slug')) {
if($page->translation('slug') == $slug) {
$_p = $page;
}
}
}*/
}
if (!$_p) {
abort(404);
}
/*echo $_p->translations(lang())->get('title').'<br>';
$crumbs[] = [
'id' => $_p->id,
'title' => $_p->translations(lang())->get('title'),
'path' => $_p->path
];*/
if ($_p && $k == $count) {
$page = $_p;
$data['page'] = $page;
$data['seo'] = $page;
if ($page->hasSubs()) {
$data['subs'] = $page->getSubs();
}
$data['banner'] = $page['banner'] ?: false;
//$data['crumbs'] = $crumbs;
if ($page->blade_view) {
return view('frontend.' . $page->blade_view)->with($data);
}
return view('frontend.page')->with($data);
}
}
}
示例11: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 20; $i++) {
\App\Page::create(['title' => $faker->sentence(5), 'text' => $faker->paragraph(5)]);
}
$pages = \App\Page::all();
for ($i = 0; $i < 5; $i++) {
$page1 = $pages->random();
$page2 = $pages->random();
if ($page1 == $page2) {
continue;
}
try {
$page1->makeChildOf($page2);
} catch (\Exception $e) {
}
}
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
/* $admin = new Role;
$admin->name = 'superadmin';
$role = Role::where('name','superadmin')->first();
var_dump($admin->getIdByRolename('superadmin'));*/
/* $admin = new Role;
$admin->name = 'superadmin';
$admin->id = 2;
$owner = new Role;
$owner->name = 'ordinary';
$owner->id = 1;
$manageUsers = new Permission;
$manageUsers->name = 'manage_users';
$manageUsers->display_name = 'Manage Users';
$manageUsers->id = 1;
//$manageUsers->save();
$managePosts = new Permission;
$managePosts->name = 'manage_pages';
$managePosts->display_name = 'Manage Pages';
$managePosts->id = 2;
//$managePosts->save();
$admin->perms()->sync(array($managePosts->id, $manageUsers->id));
$owner->perms()->sync(array($managePosts->id),$owner->id);
$user = User::where('name','=','dmodai')->first();
// 可以使用 Entrust 提供的便捷方法用户授权
// 注: 参数可以为 Role 对象, 数组, 或者 ID
$user->attachRole( $admin );
// 或者使用 Eloquent 自带的对象关系赋值
// $user->roles()->attach( $admin->id ); // id only*/
//return view('AdminHome')->withPages(Page::all());
//return view('AdminHome')->with('pages', Page::all());
return view('AdminHome', ['pages' => Page::all()]);
}
示例13: index
public function index()
{
$pages = Page::all();
return view("realestateadmin::page.index", ["pages" => $pages]);
}
示例14: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view("AdminHome")->withPages(Page::all());
}
示例15: showPages
/**
* Show all pages
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showPages()
{
$pages = Page::all();
return view('manage.page.all', compact('pages'));
}