2017 © Pedro Peláez
 

library pagemanager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

image

backpack/pagemanager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  • Tuesday, April 24, 2018
  • by tabacitu
  • Repository
  • 13 Watchers
  • 75 Stars
  • 76,704 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 36 Forks
  • 3 Open issues
  • 30 Versions
  • 11 % Grown

The README.md

BackPack\PageManager

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

An interface to let your admins add and edit presentation pages to your Laravel 6, 7, 8, 9 or 10 website, by defining page templates with any number of content areas and any number of content types. Uses Laravel Backpack., (*2)

Backpack PageManager edit page, (*3)

Security updates and breaking changes

Please subscribe to the Backpack Newsletter so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months., (*4)

Install

1) Add a file to define your page templates in app/PageTemplates.php:, (*5)

<?php

namespace App;

trait PageTemplates
{
    /*
    |--------------------------------------------------------------------------
    | Page Templates for Backpack\PageManager
    |--------------------------------------------------------------------------
    |
    | Each page template has its own method, that define what fields should show up using the Backpack\CRUD API.
    | Use snake_case for naming and PageManager will make sure it looks pretty in the create/update form
    | template dropdown.
    |
    | Any fields defined here will show up after the standard page fields:
    | - select template
    | - page name (only seen by admins)
    | - page title
    | - page slug
    */

    private function services()
    {
        $this->crud->addField([   // CustomHTML
                        'name' => 'metas_separator',
                        'type' => 'custom_html',
                        'value' => '<br><h2>'.trans('backpack::pagemanager.metas').'</h2><hr>',
                    ]);
        $this->crud->addField([
                        'name' => 'meta_title',
                        'label' => trans('backpack::pagemanager.meta_title'),
                        'fake' => true,
                        'store_in' => 'extras',
                    ]);
        $this->crud->addField([
                        'name' => 'meta_description',
                        'label' => trans('backpack::pagemanager.meta_description'),
                        'fake' => true,
                        'store_in' => 'extras',
                    ]);
        $this->crud->addField([
                        'name' => 'meta_keywords',
                        'type' => 'textarea',
                        'label' => trans('backpack::pagemanager.meta_keywords'),
                        'fake' => true,
                        'store_in' => 'extras',
                    ]);
        $this->crud->addField([   // CustomHTML
                        'name' => 'content_separator',
                        'type' => 'custom_html',
                        'value' => '<br><h2>'.trans('backpack::pagemanager.content').'</h2><hr>',
                    ]);
        $this->crud->addField([
                        'name' => 'content',
                        'label' => trans('backpack::pagemanager.content'),
                        'type' => 'summernote',
                        'placeholder' => trans('backpack::pagemanager.content_placeholder'),
                    ]);
    }

    private function about_us()
    {
        $this->crud->addField([
                        'name' => 'content',
                        'label' => trans('backpack::pagemanager.content'),
                        'type' => 'summernote',
                        'placeholder' => trans('backpack::pagemanager.content_placeholder'),
                    ]);
    }
}

2) In your terminal, (*6)

``` bash composer require backpack/pagemanager, (*7)


3) Publish the views, migrations and the PageTemplates trait:

php artisan vendor:publish --provider="Backpack\PageManager\PageManagerServiceProvider", (*8)


4) Run the migration to have the database table we need:

php artisan migrate, (*9)


5) [optional] Add a menu item for it:

For Backpack v6

php artisan backpack:add-menu-content "<:menu-item title="Pages" icon="la la-file-o" :link="\"backpack_url('page')\"">", (*10)

For Backpack v5 or v4

php artisan backpack:add-sidebar-content ", (*11)

"


## Usage 1. Go to **yourapp/admin/page** and see how it works. 2. Define your own templates in app/PageTemplates.php using the Backpack\CRUD API. ## Example front-end No front-end is provided (Backpack only takes care of the admin panel), but for most projects this front-end code will be all you need: (1) Create a catch-all route at the end of your routes file: ```php /** CATCH-ALL ROUTE for Backpack/PageManager - needs to be at the end of your routes.php file **/ Route::get('{page}/{subs?}', ['uses' => '\App\Http\Controllers\PageController@index']) ->where(['page' => '^(((?=(?!admin))(?=(?!\/)).))*$', 'subs' => '.*']);

(2) Create app\Http\Controllers\PageController.php that actually shows the page., (*12)

<?php

namespace App\Http\Controllers;

use Backpack\PageManager\app\Models\Page;
use App\Http\Controllers\Controller;

class PageController extends Controller
{
    public function index($slug, $subs = null)
    {
        $page = Page::findBySlug($slug);

        if (!$page)
        {
            abort(404, 'Please go back to our <a href="'.url('').'">homepage</a>.');
        }

        $this->data['title'] = $page->title;
        $this->data['page'] = $page->withFakes();

        return view('pages.'.$page->template, $this->data);
    }
}

(3) Create the views for those templates (how those pages actually look - the HTML CSS JS) and place them in your resources/views/pages/ directory. Inside those blade files, you can use the $page variable. That's where all the page content is stored. For more complicated pages, you can also use fake fields in your page templates. You'll also find those attributes in the $page variable., (*13)

Note: if you find yourself in need of sending extra data to a view you load on multiple pages, you should consider using a view composer;, (*14)

Extend

If you need to make any modifications to the controller, model or request, you should: - make sure config/backpack/pagemanager.php is published; if not, publish it using php artisan vendor:publish --provider="Backpack\PageManager\PageManagerServiceProvider"; - create a new controller/model that extends the one in the package; - enter controller or model in the pagemanager.php config file, and that's the one that the CRUD will be using;, (*15)

Optional: Mutator for fields using 'store_in' and 'fake' keys

Fake fields do not trigger individual mutators, they trigger the "fake column" mutator. For example instead of defining a setImageAttribute() mutator, please define a setExtrasAttribute() mutator. You'll have the $value then., (*16)

Change log

Please see CHANGELOG for more information what has changed recently., (*17)

Testing

bash $ composer test, (*18)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*19)

Overwriting Functionality

If you need to modify how this works in a project: - create a routes/backpack/pagemanager.php file; the package will see that, and load your routes file, instead of the one in the package; - create controllers/models that extend the ones in the package, and use those in your new routes file; - modify anything you'd like in the new controllers/models;, (*20)

Security

If you discover any security related issues, please email hello@backpackforlaravel.com instead of using the issue tracker., (*21)

Credits

License

Backpack is free for non-commercial use and 69 EUR/project for commercial use. Please see License File and backpackforlaravel.com for more information., (*22)

Hire us

We've spend more than 10.000 hours creating, polishing and maintaining administration panels on Laravel. We've developed e-Commerce, e-Learning, ERPs, social networks, payment gateways and much more. We've worked on admin panels so much, that we've created one of the most popular software in its niche - just from making public what was repetitive in our projects., (*23)

If you are looking for a developer/team to help you build an admin panel on Laravel, look no further. You'll have a difficult time finding someone with more experience & enthusiasm for this. This is what we do. Contact us - let's see if we can work together., (*24)

The Versions

24/04 2018

dev-unique_pages

dev-unique_pages https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

proprietary

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

13/03 2018

dev-german_translation

dev-german_translation https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

proprietary

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/03 2018

dev-master

9999999-dev https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT proprietary

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/03 2018

1.1.23

1.1.23.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

proprietary

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

02/11 2017

1.1.22

1.1.22.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

30/08 2017

1.1.21

1.1.21.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

11/08 2017

1.1.20

1.1.20.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

18/07 2017

1.1.19

1.1.19.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

06/07 2017

1.1.18

1.1.18.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/07 2017

1.1.10

1.1.10.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

30/05 2017

dev-feature/bug-38

dev-feature/bug-38 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

18/04 2017

1.1.9

1.1.9.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

11/04 2017

1.1.8

1.1.8.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

06/04 2017

1.1.17

1.1.17.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/04 2017

1.1.6

1.1.6.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/04 2017

1.1.5

1.1.5.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

05/04 2017

1.1.4

1.1.4.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

30/10 2016

1.1.3

1.1.3.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

13/10 2016

1.1.2

1.1.2.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

12/09 2016

1.1.1

1.1.1.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

31/08 2016

1.1

1.1.0.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

31/07 2016

1.0.9

1.0.9.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

31/07 2016

1.0.8

1.0.8.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

24/07 2016

1.0.7

1.0.7.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

23/07 2016

1.0.6

1.0.6.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

03/06 2016

1.0.5

1.0.5.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

02/06 2016

1.0.4

1.0.4.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

01/06 2016

1.0.3

1.0.3.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

25/05 2016

1.0.2

1.0.2.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager

25/05 2016

1.0.1

1.0.1.0 https://github.com/laravel-backpack/PageManager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\CRUD.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress crud cms admin panel backpack content management system manage pages presentation pages presentation website administer pages pagemanager