pilyavskiy / laravel-page-blocks
Dynamic create blocks for pages with views, models and migrations
Package info
gitlab.com/laravel-libs/laravel-page-blocks
pkg:composer/pilyavskiy/laravel-page-blocks
Requires
- php: ^8.3
- laravel/framework: ^13.0
Requires (Dev)
- orchestra/testbench: ^11.0
- phpunit/phpunit: ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
We create this package for dynamic create web pages, with different and changeable block.
Install package
For download package:
composer require pilyavskiy/laravel-page-blocks
The package requires PHP 8.3+ and Laravel 13. The service provider is registered automatically through Laravel package discovery.
For Laravel 8 and earlier, use the previous 0.4.x release.
Then run migrations to create the pages and page_blocks tables:
php artisan migrate
Page structure:
- id - auto increment
- page - string, unique page name
- route - string, unique page route, by value from this field, you will have access to you page.*
- title - string, your page title
- metaTitle - string, uses for html tag
<title> - metaDescription - text, uses for html tag
<description> - metaKeywords - text, uses for html tag
<keywords> - isModified - boolean, flag for modified possibility
- isDeletable - boolean, flag for delete possibility
Important: for index page use / as route
Create new page blocks
After include package, you will be available command for create new page block model:
php artisan make:pbmodel PageBlockExample
For create create new page block model with migration and view, please add flag -b
php artisan make:pbmodel PageBlockExample -b
Routes
Page blocks routes always are the last routes registered by your application.
If you need customize some pages, please registered new route for change default package route.
Publish
For publish views and migrations from package, please run
php artisan vendor:publish
And choose Provider: Pilyavskiy\PB\Providers\PBServiceProvider.
File resources/views/vendor/laravel-page-blocks/default.blade.php uses for show page with page blocks, you can edit it for your needs.
File resources/views/vendor/laravel-page-blocks/content.blade.php, file for show page blocks.
You can include this file laravel-page-blocks::content, inside your own views, but be sure that you have $page.
Tests
composer install
composer test