All Projects → pvtl → voyager-page-blocks

pvtl / voyager-page-blocks

Licence: MIT license
A module to provide page blocks for Voyager 📝

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to voyager-page-blocks

voyager-portfolio
A Portfolio Module for Laravel Voyager 💋
Stars: ✭ 15 (-81.25%)
Mutual labels:  laravel-package, voyager, laravel-5-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+147.5%)
Mutual labels:  laravel-package, laravel-5-package
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+2665%)
Mutual labels:  laravel-package, laravel-5-package
Voyager Hooks
Hooks system integrated into Voyager.
Stars: ✭ 200 (+150%)
Mutual labels:  laravel-package, laravel-5-package
Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (+42.5%)
Mutual labels:  laravel-package, laravel-5-package
Pagination
🎁 Laravel 5 Custom Pagination Presenter
Stars: ✭ 119 (+48.75%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+2521.25%)
Mutual labels:  laravel-package, laravel-5-package
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+187.5%)
Mutual labels:  laravel-package, laravel-5-package
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (+178.75%)
Mutual labels:  laravel-package, laravel-5-package
Hooks
Hooks is a extension system for your Laravel application.
Stars: ✭ 202 (+152.5%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Excel
🚀 Supercharged Excel exports and imports in Laravel
Stars: ✭ 10,417 (+12921.25%)
Mutual labels:  laravel-package, laravel-5-package
laravel-two-factor-authentication
A two-factor authentication package for Laravel >= 8
Stars: ✭ 37 (-53.75%)
Mutual labels:  laravel-package, laravel-5-package
Larabug
Laravel error reporting tool
Stars: ✭ 84 (+5%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Auto Translate
Automatically translate your language files using a translator service
Stars: ✭ 153 (+91.25%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (-1.25%)
Mutual labels:  laravel-package, laravel-5-package
Laraupdater
Enable Laravel App Self-Update. Allow your Laravel Application to auto-update itself.
Stars: ✭ 75 (-6.25%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Api Health
Monitor first and third-party services and get notified when something goes wrong!
Stars: ✭ 65 (-18.75%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Remember Uploads
Laravel Middleware and helper for remembering file uploads during validation redirects
Stars: ✭ 67 (-16.25%)
Mutual labels:  laravel-package, laravel-5-package
Voyager Frontend
The Missing Front-end for The Missing Laravel Admin 🔥
Stars: ✭ 200 (+150%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+3257.5%)
Mutual labels:  laravel-package, laravel-5-package

This repository is no longer actively maintained

Voyager Page Blocks

Voyager Frontend Screenshot

This Laravel/Voyager Frontend module is designed to give developers the ability to easily design page blocks, for Voyager admin users to build stunning frontend pages.

Built by Pivotal Agency.


Prerequisites


Installation

# 1. Require this Package in your fresh Laravel/Voyager project
composer require pvtl/voyager-page-blocks

# 2. Run the Installer
php artisan voyager-page-blocks:install

# 3. (Optional) Seed the database with example page blocks.
php artisan voyager-page-blocks:seed

Creating & Modifying Blocks

Page blocks are created & configured in 2 steps:

  1. Define the block - in /config/page-blocks.php
  2. Build the block's HTML layout - create the template in /resources/views/vendor/voyager-page-blocks/blocks

1. Define a Block

Familiarize yourself with /config/page-blocks.php. This is where you'll define each block - you'll tell it which fields the block should have (for the admin to manage) and which Blade template it should use on the frontend.

  • Each array inside this configuration file is a page block
  • Each block contains fields
  • Each field contains a unique field key
  • Each field is based on a Voyager Data Type

The below table explains what each property does and how it is relevant to the block itself:

Key Purpose
Root key This is the name of your page block, used to load the configuration
name This is the display name of your page block, used in the block 'adder'
fields This is where your page block fields live (text areas, images etc)
fields => field The content name of your field, used to store/load its content
fields => display_name The display name of this field in the back-end
fields => type The data row type that this field will use (check TCG\Voyager\FormFields)
fields => required Self-explanatory, marks this field as required or not (not available for all partials)
fields => placeholder Self-explanatory, adds a placeholder to the field (not available for all partials)
fields => details Used for selects/checkboxes/radios to supply options
template This points to your blade file for your block template
compatible TBA

2. Build the HTML

When you're ready to start structuring the display of your block, you'll need to create (or override our defaults) your blade template (located at /resources/views/vendor/voyager-page-blocks/blocks/your_block.blade.php) and use the accessors you defined in your module's configuration file to fetch each fields data ({!! $blockData->image_content !!}).


Example. Putting it all together

Let's say we want to create a new block with 1 WYSIWYG editor, called 'Company Overview'.

Step 1. Define the new block

In /config/page-blocks.php, we'll add:

$blocks['company_overview'] = [
    'name' => 'Company Overview',
    'template' => 'voyager-page-blocks::blocks.company_overview',
    'fields' => [
        'content' => [
            'field' => 'content',
            'display_name' => 'Company Overview Content',
            'type' => 'rich_text_box',
            'required' => 1,
            'placeholder' => '<p>Lorem ipsum dolor sit amet. Nullam in dui mauris.</p>',
        ],
    ],
];

Step 2. Build the HTML

In /resources/views/vendor/voyager-page-blocks/blocks, we'll create a new file called company_overview.blade.php with:

<div class="page-block">
    <div class="grid-container column text-center">
        {!! $blockData->content !!}
    </div>
</div>

Step 3. Add the block to a page

Next, jump into the Voyager Admin > Pages and click 'Content' next to a page. You'll now be able to select Company Overview from the 'Add Block' section. Add the block to the page, drag/drop it into place, edit the text etc.


Developer Controller Blocks

You may also wish to include custom logic and functionality into your page blocks. This can be done with a Developer Controller Block - simply specify your controller namespace'd path and the method you wish to call, which should return a view and you'll be on your way.

For example, the Voyager Frontend package comes with a Recent Posts method/view that you can play with and review.

From the Add Block section of the page in the admin, add the block type of Developer Controller, then input the following into the path field:

Pvtl\VoyagerFrontend\Http\Controllers\PostController::recentBlogPosts(2)

This will output 2 blog posts on the frontend. You could change the first paramter of the method to 6, to output 6 blog posts. Simples.


Troubleshooting

It is important to sanitise your field output, null values will cause errors.

It is very important that you follow the naming scheme that is setup in the example page blocks as the keys reference other cogs in the system to stitch the blocks together. There are example blocks already set up in the resources/views directory and configuration file for you to get started.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].