Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
With the installation of Voyager you will find a new configuration file located at config/voyager.php
.
In this file you can find various options to change the configuration of your Voyager installation.
If you cache your configuration files please make sure to run php artisan config:clear
after you changed something.
Below we will take a deep dive into the configuration file and give a detailed description of each configuration set.
add_default_role_on_register: Specify whether you would like to add the default role to any new user that is created. default_role: You can also specify what the default_role is of the user. admin_permission: The permission needed to view the admin dashboard. namespace: The namespace of your apps User Class. redirect: Redirect path after the user logged in.
You can specify the default controller
namespace of Voyager. If you ever wish to override any of the core functionality of Voyager you can do so by duplicating the Voyager controllers and specifying the location of your custom controllers.
Overwrite a single controller
If you only want to overwrite a single controller, you might consider adding the following piece of code to your AppServiceProvider
class in the register
method.
$this->app->bind(VoyagerBreadController::class, MyBreadController::class);
You can specify the namespace or location of your models. This is used when creating the Models from the database section of Voyager. If not defined the default application namespace will be used.
You may wish to specify a different asset path. If your site lives in a subfolder you may need to include that directory to the beginning of the path. This may also be used in case you wish to duplicate the published assets and customize your own.
When upgrading to new version of voyager the assets located in the /vendor/tcg/voyager/assets
directory may need to be overwritten, so if you wish to customize any styles you will want to duplicate that directory and specify the new location of your asset_path.
By default Voyager is going to use the public
local storage. You can additionally use any driver inside of your config/filesystems.php
. This means you can use S3, Google Cloud Storage, or any other file storage system you would like.
You may wish to hide some database tables in the Voyager database section. In the database config you can choose which tables would like to hide.
autoload_migrations
allows you to exclude Voyagers migration-files from loading when running php artisan migrate
.
You can specify whether or not you want to enable mutliple languages. You can then specify your default language and all the support languages (locales)
Read more about multilanguage here.
In the dashboard config you can add navbar_items, make the data_tables responsive, and manage your dashboard widgets.
navbar_items Include a new route in the main user navbar dropdown by including a 'route', 'icon_class', and 'target_blank'.
data_tables If you set 'responsive' to true the datatables will be responsive.
widgets Here you can manage the widgets that live on your dashboard. You can take a look at an example widget class by viewing the current widgets inside of tcg/voyager/src/Widgets
.
The default primary color for the Voyager admin dashboard is a light blue color. You can change that primary color by changing the value of this config.
In the Voyager admin there are developer tips or notifications that will show you how to reference certain values from Voyager. You can choose to hide these notifications by setting this configuration value to false.
You can add your own custom stylesheets that will be included in the Voyager admin dashboard. This means you could technically create a whole new theme for Voyager by adding your own custom stylesheet.
Read more here.
The path will be passed to Laravels asset function.
The same goes for this configuration. You can add your own javascript that will be executed in the Voyager admin dashboard. Add as many javascript files as needed.
Read more here.
There is a new data type called coordinates that allow you to add a google map as a datatype. The user can then drag and drop a pin in the Google Maps to save a longitude and latitude value in the database.
In this config you can set the default Google Maps Keys and center location. This can also be added to your .env file.
To allow/disallow mimetypes to be uploaded through the media-manager you can define an array allowed_mimetypes
:
The user can only upload files with the given mimetypes. If you want to allow all types to be uploaded you can use the following:
Voyager is super easy to install. After creating your new Laravel application you can include the Voyager package with the following command:
Next make sure to create a new database and add your database credentials to your .env file, you will also want to add your application URL in the APP_URL
variable:
Finally, we can install Voyager. You can choose to install Voyager with dummy data or without the dummy data. The dummy data will include 1 admin account (if no users already exist), 1 demo page, 4 demo posts, 2 categories and 7 settings.
To install Voyager without dummy data simply run
If you prefer installing it with the dummy data run the following command:
Specified key was too long error If you see this error message you have an outdated version of MySQL, use the following solution: https://laravel-news.com/laravel-5-4-key-too-long-error
And we're all good to go!
Start up a local development server with php artisan serve
And, visit the URL http://localhost:8000/admin in your browser.
If you installed with the dummy data, a user has been created for you with the following login credentials:
email:
admin@admin.com
password:password
Quick note A dummy user is only created if there are no current users in your database.
If you did not go with the dummy user, you may wish to assign admin privileges to an existing user. This can easily be done by running this command:
If you wish to create a new admin user you can pass the --create
flag, like so:
And you will be prompted for the users name and password.
This section is meant for users who are installing Voyager on an already existing Laravel installation or for users who want to perform a manual install. If this is not the case, you should go back to the installation documentation or skip this section.
The first thing you should do is publish the assets that come with Voyager. You can do that by running the following commands:
Next, call php artisan migrate
to migrate all Voyager table.
If you want to change migrations, for example to use a different table for users, don't migrate. Instead copy Voyagers migrations to database/migrations
, make your changes, turn off the config option database.autoload_migrations
and then migrate.
Now, open your User-Model (usually app/User.php
) and make the class extend \TCG\Voyager\Models\User
instead of Authenticatable
.
The next step is to add Voyagers routes to your routes/web.php
file:
Now run
php artisan db:seed --class=VoyagerDatabaseSeeder
to seed some necessary data to your database,
php artisan hook:setup
to install the hooks system, and
php artisan storage:link
to create the storage symlink to your public folder.
After that, run composer dump-autoload
to finish your installation!
Before installing Voyager it is very important to take a quick moment to learn what it is & what it isn't.
An admin interface for your Laravel app
An easy way to add/edit/delete data for your app
A menu builder (build menus in Voyager for your app)
A media manager for your files
CRUD/BREAD generator (learn more about BREAD here)
Voyager is simply an admin for your Laravel app. Whatever you want your app to do on the front-end is completely up to you. You are in control of your application and you can use Voyager to make your life easier by adding data, editing users, creating menus, and many other administrative tasks.
A content management system (CMS)
A blogging platform
Wordpress (Bleh! 😜)
Voyager is not a CMS or a blogging platform. But it can be used to create a CMS or a blogging platform, but out of the box it is neither of those. As stated in the previous section you have full control on what your application will do and how it will function.
With Laravel & Voyager you can create any kind of application your heart desires. Laravel & Voyager are simply tools to make it easier to build.
In Voyager a Checkbox is converted into a toggle switch, and as you can see above the on
key will contain the value when the toggle switch is on, and the off
will contain the value that is set when the switch is off. If checked
is set to true the checkbox will be toggle on; otherwise by default it will be off.
You can create as many checkboxes as you want.
The Radio button is exactly the same as the dropdown. You can specify a default
if one has not been set and in the options
object you will specify the value of the option on the left and the text to be displayed on the right.
Before installing Voyager make sure you have installed one of the following versions of Laravel:
Laravel 6
Laravel 7
Laravel 8
Additionally Voyager requires you to use PHP 7.3 or newer.
Please take a look at our prerequisites before upgrading!
To update to the latest version inside of your composer.json file make sure to update the version of Voyager inside the require declaration inside of your composer.json to:
tcg/voyager": "1.4.*
And then run composer update
The roles BREAD now uses it's own controller.
Please update it to use TCG\Voyager\Http\Controllers\VoyagerRoleController