Quarx Documentation#

Quarx is a CMS for Laravel applications. It provides numerous components that enable developers to put together powerful applications but also provide the means for people to edit the content of those powerful applications.

Quarx comes with a module builder for all your custom CMS needs, as well as a module migration and publishing tools. So if you decide to reuse some modules on future projects you can easily publish thier assets seamlessly. If you wish to make your Quarx module into a PHP package, then you will need to have it publish its assets to the quarx/modules directory.

Installation#

Create a new Laravel application, and make a database somewhere and update the .env file.

  • Run the following command:
composer require yab/quarx
  • Add the following to your Providers:
Yab\Quarx\QuarxProvider::class,
  • Then run the vendor publish:
php artisan vendor:publish --provider="Yab\Quarx\QuarxProvider"

If you wish to use the publish datetime picker - set your app's timezone config to correspond with your location

Simple Setup#

The simple setup requires a fresh Laravel application.

If you're looking to do a simple website with a powerful CMS, and the only people logging on to the app are the CMS managers. Then you can run the setup command. Quarx will install everything it needs, run its migrations and give you a login to start with. Take control of your website in seconds.

php artisan quarx:setup

Now your done setup. Login, and start building your amazing new website!

You can login as an admin with the following credentials:

U: admin@example.com
P: admin

Complex Setup#

Complex setup is needed for applications that have already had some work done.

If you just want to add Quarx to your existing application and already have your own

  • Add the following to your routes provider:
require base_path('routes/quarx.php');
  • Add the following to your app.scss file, you will want to modify depending on your theme of choice.
@import "resources/themes/default/assets/sass/_theme.scss";
  • Then migrate:
php artisan migrate
  • Then add to the Kernel Route Middleware:
'quarx' => \App\Http\Middleware\Quarx::class,
'quarx-api' => \App\Http\Middleware\QuarxApi::class,

In order to have modules load as well please edit the autoload psr-4 portion to your composer file:

"autoload": {
    ...
    "psr-4": {
        "App\\": "app/",
        ...
        "Quarx\\": "quarx/"
        }
}

Quarx Access#

Route to the administration dashboard is "/quarx/dashboard".

Quarx requires Laracogs to run (only for the FormMaker), but Quarx does not require you to use the Laracogs version of roles. But you will still need to ensure some degree of control for Quarx's access. This is done in the Quarx Middleware, using the gate and the Quarx Policy. If you opt in to the roles system provided by Laracogs, then you can replace 'quarx' with admin to handle the Quarx authorization, if not, you will need to set your own security policy for access to Quarx. To do this simply add the Quarx policy to your app/Providers/AuthServiceProvider.php file, and ensure that any rules you wish it to use are in within the policy method. We suggest a policy similar to below.

Possible Quarx Policy:

Gate::define('quarx', function ($user) {
    return (bool) $user;
});

Or Using Laracogs:

Gate::define('quarx', function ($user) {
    return ($user->roles->first()->name === 'admin');
});

API Endpoints#

Quarx comes with a collection of handy API endpoints if you wish to use them. You can define your own policies for access and customize the middleware as you see fit.

Token#

The basic Quarx API endpoints must carry the Quarx apiToken defined in the config for the app. This can be provided by adding the following to any request:

?token={your token}

** All published and public facing data will be available via the API by default.

/quarx/api/blog
/quarx/api/blog/{id}
/quarx/api/events
/quarx/api/events/{id}
/quarx/api/faqs
/quarx/api/faqs/{id}
/quarx/api/files
/quarx/api/files/{id}
/quarx/api/images
/quarx/api/images/{id}
/quarx/api/pages
/quarx/api/pages/{id}
/quarx/api/widgets
/quarx/api/widgets/{id}

Also Provides#

The Quarx package also provides the following packages:

  • DevFactory/Minify
  • Yab/Laracogs