Version 2.0 released

Version 2.0 has been in development for almost a year now, and it's finally time. Version 2.0 has been tagged

A lot has changed, from new features to organisation changes. We'll go over the most important changes in this post.

Besides all the features listed below, a lot of the codebase has ben rewritten and optimised across the board.

Organisation

On version 1, github.com/asgardcms contained all modules and platform. Platform itself didn't have any modules present as they were all fetched via composer. This worked well at the start but quickly made contributing to the CMS pretty tedious.

In order to improve the general contribution workflow, this has greatly changed in version 2. Platform version 2 now has the modules committed. This makes contributing much easier and faster. Just clone the platform repository, and you're ready to go. 

Don't be alarmed, modules are still separated from the platform, they are now in a new GitHub organisation: https://github.com/Idavoll. These should never be touched manually, they're being kept up to date automatically.

laravel-modules

Previously pingpong/modules package was used to manage modules, it was however not maintained anymore, and asgardcms was using my forked version for a long time (it had a repositories key in composer.json). This was getting annoying to maintain. I've then decided to recreate the package under my namespace, nwidart/laravel-modules, applying changes that were broken in the original and most importantly added a full test suite to make sure it keeps working as expected.

Laravel 5.4

AsgardCMS has been upgraded to use laravel 5.4, previously version 1 was on the LTS version 5.1. All new shiny laravel features are thus available to you.

Media relation changes

It is now easier than ever to handle media on your custom modules. There are 2 new blade directives @mediaSingle and @mediaMultiple. 

It is no longer needed to have a bunch of additional steps of fetching the media in the controller. 

View the new documentation of linking media.

Media thumbnail definition

In version 1, thumbnails were defined in a configuration file. This was causing issues with the config:cache command, which doesn't work when there are closures in the configuration. This could happen on some thumbnail types. To avoid this, thumbnails are now defined programmatically via an easy to use api. 

Example from the BlogServiceProvider:

$this->app[ThumbnailManager::class]->registerThumbnail('smallThumb', [
    'resize' => [
        'width' => 50,
        'height' => null,
        'callback' => function ($constraint) {
            $constraint->aspectRatio();
            $constraint->upsize();
        },
    ],
]);

View the full documentation on this subject.

Better menu management

Menu management now has more options to have more control over how a menu item should function. 

Tags!

This is a new module, Tag. Everything (entities) can now easily be tagged thanks to this module.

Tagging an entity is as easy as calling the custom blade directive in your views:

@tags('asgardcms/recipe', $recipe)

Tags have a namespace feature (asgardcms/recipe in example). This allows tags to only be visible in those namespaces. A tag created from module A, won't be visible in module B. Given both modules are using the tag feature.

Two new documentation pages were added to explain this functionality. 

Authentication contract

The Authentication contract has changed namespace and is now under the User module, which makes more sense.

The check() method now doesn't return the user when someone is logged in, but will always return a boolean if logged in or not.

To get the user, there's a new method user().

Better permission management

It is now possible to inherit permissions from the role! Previously, if a user had a role with specific permissions, and that user was updated via the backend, all its permissions were written on the user itself. Making changes on the role not affect the user permissions anymore. 

Thanks to the inherit feature this is no longer the case.

Permissions are also no longer checked via the urlThey are now handled via a new middleware and can be used on your routes like so:

$router->get('users', [
    'as' => 'admin.user.user.index',
    'uses' => 'UserController@index',
    'middleware' => 'can:user.users.index',
]);

In this example we want this specific route to only be accessible by users that have the user.users.index permission.

Custom sidebar classes

It's now very easy to customise the (backend) sidebar for every single module. No more need to customise a core module, you can overwrite for each module, a custom sidebar class so  you can change labels, ordering and so on.

Changelogs

Complete changelogs can be viewed on the documentation page, available for each module and platform.

Upgrading

Upgrading from 2.0 beta.

Upgrade will be easy and quick, simply update the dependencies in your main composer.json file according to the one provided in the platform repository, and run composer update. After this you may need to fix issues following the laravel 5.4 upgrade guide.

Make sure you have an APP_URL set in your .env file, next add the following 2 lines in the filesystem.php configuration file. https://github.com/AsgardCms/Platform/blob/2.0/config/filesystems.php#L59-L60

Upgrading from version 1.

This will be more complex as version was using laravel version 5.1. The method I suggest is setting up a new 2.0 project, and moving your custom modules inside this project. You will then have to adapt those modules according tho the 2.0 changelogs and upgrade guides available on the documentation (listed before under changelogs title). 

Supporter Plans

In case you missed it you can support the AsgardCMS project with a plan starting at only 9,99 monthly!

View all supporter plans here.


Mobile Analytics