Warning!
You probably don't want to use `--force` without also using `--tag=assets`!
composer.json to the version you want (or leave a ^ in the version...)enso composer update --with-dependencies yadda/enso-coreYou will probably need to publish Enso JS, CSS, webpack.mix.js etc.
# Publish ALL files (won't overwrite existing files)
enso artisan vendor:publish
# Force re-publish only css and js files
enso artisan vendor:publish --force --tag=assets
Add the following to config/enso/media.php:
/**
* How to handle resizing gifs
*
* original = provide URL for original file, regardless of requested preset
* warp = force the gif to the requested size without cropping
* crop = resize image and crop accordingly
*/
'gif_strategy' => env('ENSO_GIF_STRATEGY', 'crop'),
If you are using the IsPublishable Enso trait and you use the PublishAt date, you will need to add it it manually to your models with:
/**
* Gets the name of the Publish At column on this publishable
*
* @return string
*/
public function getPublishAtColumn()
{
return 'publish_at';
}
The following attribute modifiers have been removed from the trait. If you are still using them or their attribute calls, you should move over to using a DateTimeField instead.
getPublishAtHoursAttribute
setPublishAtHoursAttribute
getPublishAtMinutesAttribute
setPublishAtMinutesAttribute
This trait now throws PublishableException instead of basic Exceptions
The accessibleToUser query scope now only accepts instances of UserContract, or null to use the current Authenitcated User
The isPublished query scope has been renamed to published to prevent potential collision with the function of the same name. isNotPublished has likewise been converted to notPublished.
The default textarea rowspec has been removed from the Page content field. It was rarely used but if you want to keep it you should add the following to your own Page CRUD config.
FlexibleContentSection::make('textarea')
->setLabel('Textarea')
->addFields([TextareaField::make('textarea')]),
Yadda\Enso\Crud\Forms\Sections\TextImageSection has been removed completely. If you need it, you should define it yourself, i.e. in App\Crud.
Yadda\Enso\Crud\Forms\Sections\ImageTextSection has been updated to include title, section title, id, alignment, etc. The previously existing Wysiwyg field was called text. It has been updated to content. You should either update your data to be inline with this (this is preferable), or override the rowspec and rename the field.
HasUuids has been changed to only reference a single uuid column. Replace your protected $uuids_columns array with a protected $uuid_column string.
Additionally, if you installed webpatser/laravel-uuid:2.* for the previous version, you may also remove it.
If your app already has traits for HasUuid, for frontend controller UsesPages or for Crud PublishesItems and IsPublishableCrud, you can now replace them with their Enso counterparts.
No changes required
Code quality tool config files now come bundled with Enso. You may need to install a few packages:
enso yarn add eslint prettier eslint-config-airbnb eslint-config-prettier eslint-plugin-prettier stylelint-config-airbnb
composer global require squizlabs/php_codesniffer
No changes required.
A Vuex store has been added by default. You will need to add it with yarn add vuex.
After this, you will need to update resources/assets/js/enso.js to import and include the store
into your base Vue component. It should look something like:
import store from "./vendor/enso/store";
/**
* Add custom store modules here with store.registerModule(moduleName, storeModule);
*/
var App = new Vue({
store,
mixins: [admin_mixin]
});
This update introduces image optimization though it is disabled by default. You should add this option to config/enso/media.php:
/**
* If true, resized images will be run through Spatie Image Optimizer
*/
'optimize_images' => env('ENSO_OPTIMIZE_IMAGES', false),
If you want to enable image optimization, you should enable this option and install the appropriate optimizers.
No changes required.
Update Mix to 4.x.x
yarn add laravel-mix@^4.0.14 sass@^1.16.0 sass-loader@^7.1.0 query-string
Remove .mix from webpack.mix.js
let mix = require("laravel-mix").mix;
// becomes
let mix = require("laravel-mix");
getSectionByName, removeSectionByName, getFieldByName and removeFieldByName with their new counterparts: getSection, removeSection, getField, removeField respectively.No additional changes required
resources/views/crud/flex-partials/default-row.blade.phpresources/views/crud/flex-partials/flexible-content.blade.phpYou can now use the make() method on Fields and sections. For example, instead of:
$form->getSectionByName('content')
->getFieldByName('content')
->addRowSpecs([
(new FlexibleContentSection('wysiwyg'))
->addFields([
(new WysiwygField('wysiwyg')),
])
->addSettingsFields([
(new CheckboxField('hidden'))
->setLabel('This is the label')
->setOptions([
'hidden' => 'Hidden',
])
->setDefaultValue(0),
]),
]);
...you can now do this:
$form->getSectionByName('content')
->getFieldByName('content')
->addRowSpecs([
FlexibleContentSection::make('wysiwyg')
->addFields([
WysiwygField::make('wysiwyg'),
])
->addSettingsFields([
CheckboxField::make('hidden')
->setLabel('This is the label')
->setOptions([
'hidden' => 'Hidden',
])
->setDefaultValue(0),
]),
]);
The old way will still work the same as before but this should make things easier to read.
If you do not need the Mailer - Do nothing. Otherwise, see the documentation for including Mailer
Due to the inability to return non-file responses to Download based Bulk Actions, the routing has changed.
is_download is no longer a valid parameter for a bulk action. It should be removed.route parameter should direct to a controller that checks to see whether a download is allowed, returning success or error states.Margin has been added to the bottom of <p>s in WYSIWYG. If you have previously compensated for this on the fronted by removing/adding margin on frontend <p>s then you will need to refactor this.
You will need to the following to config/enso/media.php:
/**
* Whether or not to show the "this file is in use and can not be deleted"
* message. If false a generic "this may be in use" message will be
* shown instead.
*/
'show_file_in_use_message' => env('ENSO_MEDIA_FILE_IN_USE_DIALOG', false),
This update adds the new file uploader. You should replace ImageUploadField, AudioUploadField, VideoUploadField and FileUploadField with FileUploadFieldResumable.
Add the HasFilesTrait to every model that has files.
Install some extra packages.
composer update yadda/enso-core --with-dependencies
yarn add portal-vue
Migrate your database.
php artisan migrate
Add the following to config/enso/crud.php:
'file' => [
'controller' => Yadda\Enso\Media\Controllers\FileController::class,
'config' => Yadda\Enso\Media\Crud\File::class,
'model' => Yadda\Enso\Media\Models\MediaFile::class,
],
Add the following to config/app.php:
Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider::class,
You can publish auth views (login, register etc) by running the following command. This will overwrite existing auth views, so you should only do this if your current ones haven't already been styled.
php artisan vendor:publish --force --tag=authviews
Google Analytics/GTag/GTM settings and views are now available. You should upgrade the site to use them. See the Google Analytics page for details.
Add the EnsoMeta facade to your config/app.php:
'EnsoMeta' => Yadda\Enso\Facades\EnsoMeta::class,
Add meta tags to your layouts/app.blade.php and whereever else you need it. In the <head> replace your <title> with:
@include('enso-meta::display');
You can now remove the uploader_preview and (if you're not using it for your own thumbnails) thumbnails presets from config/enso/media.php.
Many getters have been removed from Yadda\Enso\Meta\Traits\HasMeta. If you are using your own meta template, this may cause you some problems, but you should probably just replace that with the include above anyway.
Page Crud no longer uses HTMLPurifier. This should be an improvement but you may wish to search for e.g. & and replace with &.
You will need to publish new files (not just force re-publish the assets tag). Then add two new routes
Route::post('admin/pages/publish', 'Admin\PagePublishController@publish')->name('admin.pages.publish');
Route::post('admin/pages/unpublish', 'Admin\PagePublishController@unpublish')->name('admin.pages.unpublish');
You will need to install sweetalert2
yarn add sweetalert2
You will need to install resumablejs
yarn add resumablejs
You will need to install moment-timezone
yarn add moment-timezone
You will need to use this workaround in order for the migrations to work:
Publish the error views
php artisan vendor:publish --tag=errors
crud.[views_dir].[view_name]. NOTE: This change does not affect the location of Flexible Content Templates.enso::navbar to enso::layouts.partials.navbarmax_depth property to your enso.menu config file. Enso Default is 2, although all current apps (at time of writing) can only utilise 1 well.Asset publishing from enso has been updated. Re-publishing the assets is only half the update this time.
For existing builds, you'll also need to create /resources/assets/js/enso.js/, and add the following code
(that would normally deployed with the first run of Enso)
// Make all App specific changes in this file.
import Vue from "vue";
// This import is your base enso-admin file. You should
// not edit it, it will be overriden as JS changes to Enso
// are made.
import admin_mixin from "./vendor/enso/enso-admin";
var App = new Vue({
mixins: [admin_mixin]
});
You can then udpate your webpack's admin js call to:
.js('resources/assets/js/enso.js', 'public/js/enso-admin.js')
Similarly, you can create the new file /resources/assets/sass/enso.scss/, and add:
@import "enso/enso-admin";
You can then update your webpack's admin scss call to:
.sass('resources/assets/sass/enso.scss', 'public/css/enso-admin.css')
This will give you a place to add your own javascript and styles that won't get overwritten by publishing assets that are often required by Enso update.
Finally, you can update your resolved modules list to just these two. Everything else is redundant.
modules: [
path.resolve(__dirname, "vendor/yadda/enso-core/resources/assets/js"),
path.resolve(__dirname, "node_modules")
];
You 'May' also need to update version of js files. We really need to get better at that bit
Crud Search functionality has been deprecated. After republishing assets, consider
refactoring and existing search boxes into Filters. At some point, Search WILL be
removed.
You will need to add the following to your webpack.mix.js in order for SVGs to work:
.version([
'public/svg/sprite.svg'
])
html and json. It is now stored in in "your_field_name": {"html": '', "json": ''}.Grimzy\LaravelMysqlSpatial\SpatialServiceProvider::class, to you config/app.php providers.yarn add vue2-leaflet'uploader_preview' => [200, 200], to presets in config/enso/media.php.fillable, casts and attributes arrays amended. If you have overridden these, you will need to ensure you have everything new from Enso.data on your pages table that ISN'T a json column for a JsonDataSection, you will need to remove referece to it in your overriden page model.<p> tags, you will need to remove those (and possibly updated the database to remove them where they are stored)Yadda\Enso\EnsoMediaServiceProvider::class, in app/config.phpYadda\Enso\Media\MediaFile (or ImageFile etc etc) to get_class(resolve(\Yadda\Enso\Media\Contracts\MediaFile::class)) (probably use a use statement). The former will still work, but if you have (or do) extend a File model, it will not act in the expected way across the whole site if.Yadda\Enso\EnsoUserServiceProvider::class, in app/config.phpphp artisan vendor:publish, to push new extendable files.config/enso/crud.php to be more like:'role' => [
'controller' => App\Http\Controllers\Admin\RoleController::class,
'config' => App\Crud\Role::class,
'model' => App\Role::class,
],
'user' => [
'controller' => App\Http\Controllers\Admin\UserController::class,
'config' => App\Crud\User::class,
'model' => App\User::class,
],
Copy Functionality from existing App\Crud\EnsoUser to App\Crud\User;
App\Crud\EnsoRole to App\Crud\Role;Register new bindings if (and you almost certainly are) overriding in a ServiceProvider
use Yadda\Enso\Users\Contracts\User as UserContract;
use App\User as UserConcrete;
use Yadda\Enso\Users\Contracts\roles as RoleContract;
use App\Role as RoleConcrete;
...
public function register()
{
app()->bind(UserContract::class, UserConcrete::class);
app()->bind(RoleContract::class, RoleConcrete::class);
}
Potentially Update The following files to extends their new base versions (name change) if they exist
App\Http\Controllers\Admin\UserController.php from use Yadda\Enso\Users\Controllers\EnsoUserController to use Yadda\Enso\Users\Controllers\UserControllerApp\Http\Controllers\Admin\RoleController.php from use Yadda\Enso\Users\Controllers\EnsoRoleController to use Yadda\Enso\Users\Controllers\RoleControllerThis update changed some Vue components. You will need to republish the assets and recompile.
php artisan vendor:publish --force --tag=assets
npm run dev
You may also need to install an older version of vue2-dropzone to make images display correctly.
yarn add [email protected]
For WYSIWYG support you will need to install Quill and Quill Render.
yarn add quill quill-render
Add the following to the config in webpack.mix.js:
const webpack = require('webpack');
// ... and ...
plugins: [
new webpack.NormalModuleReplacementPlugin(/^\.\/package$/, function (result) {
if (/cheerio/.test(result.context)) {
result.request = "./package.json"
}
}),
]
resources/views/crud/create.blade.phpresources/views/crud/edit.blade.phpuse Yadda\Enso\Media\Contracts\ImageFile as ImageFileContract;Yadda\Enso\Media\Models\ImageFile with $image_model = resolve(ImageFileContract::class);.'import_directory' attribute to config/enso/media.php. Default value is 'imports'.'original_filename' added to files table.[] to "[]".crud.update.rules you will need to add $id as a second parameter and update the number of parameters parameter.'disk' attribute to config/enso/media.php. Default value is 'local' but you may wish to use 's3' or something.'directory' attribute to config/enso/media.php. Default value is 'media'.If you're using deployer, you can use the deploy:public_disk task to link the storage directory to the shared storage directory. E.g.
after('deploy:symlink', 'deploy:public_disk');
Add the following to providers in config/app.php
Mews\Purifier\PurifierServiceProvider::class,
Add the following to aliases in config/app.php
'Purifier' => Mews\Purifier\Facades\Purifier::class,
Create config/purifier.php OR run the following
php artisan vendor:publish --provider="Mews\Purifier\PurifierServiceProvider"
Add routes for admin pages, users, roles and media to your routes/web.php
EnsoCrud::routes('admin/pages', "\\" . config('enso.crud.page.controller'), 'admin.pages');
EnsoCrud::routes('admin/users', "\\" . config('enso.crud.user.controller'), 'admin.users');
EnsoCrud::routes('admin/roles', "\\" . config('enso.crud.role.controller'), 'admin.roles');
Route::post('admin/media/upload', ['as' => 'admin.media.upload', 'uses' => '\Yadda\Enso\Media\Controllers\UploadsController@uploadFile']);
config/enso/media.php now has a mime_types attribute for pairing mime types with Media types.