Upgrade Guide

v2.0.0

Changelog:

  • Upgraded to Laravel 9.
  • Added: Webhooks.
  • Added: Embeddable Forms.
  • Added: Repeatable fields.
  • Added: Option for enabling public API access (unauthenticated get requests).
  • Added: Timepicker option for the date field type.
  • Added: New field type: Color picker.
  • Added: Allow multiple option to the enumeration field type.
  • Fixed: refreshing the page issue when saving project settings.
  • Fixed: the thumbnail issue while uploading files.
  • Fixed: change password issue.
  • Fixed: unnecessary query in the content resource for collections.
  • Fixed: small UI issues.

Upgrading to v2.0.0

# 1- Backup

Before upgrading, make sure to backup your database and files in your storage folder.

# 2- PHP version

Make sure your PHP version is 8.1 or higher.

# 3- Database

There has been some additions to the database structure. You can apply the changes by following one of these options.

Option 1 (using terminal)
  1. Replace the migration files
    database/migrations/2022_03_06_162012_add_disk_field_to_media_table.php
    database/migrations/2022_03_08_152849_add_disk_field_to_projects_table.php
    database/migrations/2022_06_08_145410_create_webhooks_table.php
    database/migrations/2022_06_09_120727_create_webhook_collections_table.php
    database/migrations/2022_06_21_151142_create_webhook_logs_table.php
    database/migrations/2022_10_07_134859_create_jobs_table.php
    database/migrations/2022_12_07_100137_create_forms_table.php
    database/migrations/2022_12_07_100217_add_form_id_to_content_table.php
    database/migrations/2022_12_08_171001_add_public_api_field_to_projects_table.php
  2. Open the terminal
  3. Go to your Elmapi folder
  4. Run the following command: php artisan migrate
Option 2 (manually)

Run following sql queries:

create table `webhooks` (`id` bigint unsigned not null auto_increment primary key, `project_id` int not null, `name` varchar(255) not null, `description` varchar(255) null, `url` varchar(255) not null, `secret` varchar(255) null, `collection_ids` varchar(255) not null, `events` varchar(255) not null, `sources` varchar(255) not null, `payload` tinyint(1) not null default '1', `status` tinyint(1) not null default '1', `created_by` int not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
create table `webhook_collections` (`id` bigint unsigned not null auto_increment primary key, `webhook_id` int not null, `collection_id` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
create table `webhook_logs` (`id` bigint unsigned not null auto_increment primary key, `project_uuid` varchar(255) not null, `webhook_id` int not null, `action` varchar(255) null, `url` varchar(255) null, `status` varchar(255) null, `request` json null, `response` json null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
create table `jobs` (`id` bigint unsigned not null auto_increment primary key, `queue` varchar(255) not null, `payload` longtext not null, `attempts` tinyint unsigned not null, `reserved_at` int unsigned null, `available_at` int unsigned not null, `created_at` int unsigned not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
alter table `jobs` add index `jobs_queue_index`(`queue`)
create table `forms` (`id` bigint unsigned not null auto_increment primary key, `uuid` varchar(36) not null, `name` varchar(255) not null, `description` varchar(255) null, `submit_btn_text` varchar(255) not null default 'Submit', `fields` json null, `project_id` int not null, `collection_id` int not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
alter table `forms` add unique `forms_uuid_unique`(`uuid`)
alter table `content` add `form_id` int null after `locale`
alter table `projects` add `public_api` tinyint(1) null default '0' after `disk`
# 4- Replace the vendor folder

The vendor folder has been changed. You can apply the changes by following one of these options.

Option 1 (using composer)
  1. Replace the composer.json file
  2. Open the terminal
  3. Go to your Elmapi folder
  4. Run the following command: composer update
Option 2 (manually)

Replace the whole vendor folder with the new one.

# 5- Replace the other files

1- Move resources/lang folder to your root folder. It should look like this:

app
bootstrap
config
database
lang
...

2- Replace the following files. Create the necessary directories.

.env.example

app/Elmapi/ElmapiHelpers.php
app/Elmapi/WebhookHelper.php

app/Events/ContentCreated.php
app/Events/ContentDeleted.php
app/Events/ContentPublished.php
app/Events/ContentRestored.php
app/Events/ContentTrashed.php
app/Events/ContentUnpublished.php
app/Events/ContentUpdated.php
app/Events/FormSubmitted.php

app/Http/Controllers/API/ContentController.php
app/Http/Controllers/API/MediaController.php
app/Http/Controllers/API/ProjectsController.php

app/Http/Controllers/CollectionFieldsController.php
app/Http/Controllers/ContentController.php
app/Http/Controllers/FormController.php
app/Http/Controllers/MediaLibraryController.php
app/Http/Controllers/ProjectsController.php

app/Http/Middleware/VerifyCsrfToken.php

app/Http/Resources/ContentResource.php

app/Listeners/FinalWebhookCallFailedListener.php
app/Listeners/ProcessWebhooks.php
app/Listeners/WebhookCallSucceededListener.php

app/Models/Collection.php
app/Models/CollectionField.php
app/Models/Content.php
app/Models/ContentMeta.php
app/Models/Form.php
app/Models/Media.php
app/Models/Project.php
app/Models/Webhook.php
app/Models/WebhookLog.php

app/Providers/EventServiceProvider.php

composer.json
composer.lock

config/database.php
config/filesystems.php
config/webhook-server.php

database/migrations/2022_03_06_162012_add_disk_field_to_media_table.php
database/migrations/2022_03_08_152849_add_disk_field_to_projects_table.php
database/migrations/2022_06_08_145410_create_webhooks_table.php
database/migrations/2022_06_09_120727_create_webhook_collections_table.php
database/migrations/2022_06_21_151142_create_webhook_logs_table.php
database/migrations/2022_10_07_134859_create_jobs_table.php
database/migrations/2022_12_07_100137_create_forms_table.php
database/migrations/2022_12_07_100217_add_form_id_to_content_table.php
database/migrations/2022_12_08_171001_add_public_api_field_to_projects_table.php

package-lock.json
package.json

public/css/app.css

public/js/app.js
public/js/form.js

public/js/partials/home.js
public/js/partials/profile.js
public/js/partials/project.collection.js
public/js/partials/project.collection.show.js
public/js/partials/project.content.edit.js
public/js/partials/project.content.forms.js
public/js/partials/project.content.forms.show.js
public/js/partials/project.content.js
public/js/partials/project.content.list.js
public/js/partials/project.content.new.js
public/js/partials/project.js
public/js/partials/project.media.js
public/js/partials/project.settings.api.js
public/js/partials/project.settings.js
public/js/partials/project.settings.locales.js
public/js/partials/project.settings.users.js
public/js/partials/project.settings.webhooks.js
public/js/partials/project.settings.webhooks.logs.js

public/mix-manifest.json

resources/css/app.css

resources/js/app.js
resources/js/filters.js
resources/js/form.js
resources/js/layouts/App.vue
resources/js/layouts/Form.vue
resources/js/pages/Collection/CollectionShow.vue
resources/js/pages/Content/ContentEdit.vue
resources/js/pages/Content/ContentForms.vue
resources/js/pages/Content/ContentFormsShow.vue
resources/js/pages/Content/ContentFormsSidebar.vue
resources/js/pages/Content/ContentNew.vue
resources/js/pages/Content/ContentTable.vue
resources/js/pages/Profile.vue
resources/js/pages/Project/Settings.vue
resources/js/pages/Project/SettingsAPI.vue
resources/js/pages/Project/SettingsNav.vue
resources/js/pages/Project/WebhookLogs.vue
resources/js/pages/Project/Webhooks.vue
resources/js/plugins/colorpicker.js
resources/js/routes.js

resources/views/forms/embeded.blade.php
resources/views/forms/preview.blade.php

routes/api.php
routes/web.php

webpack.mix.js

Troubleshooting

If you encounter any errors after upgrading, delete these two files and try again:

bootstrap/cache/packages.php
bootstrap/cache/services.php

v1.1.2

Changelog:

  • Added: API endpoints for managing Media Library
  • Added: uploading files via API
  • Added: AWS S3 Upload feature.
  • Added: whereRelation filter option.
  • Added: Include timestamps option to API requests.
  • Added: API error message when the field doesn't exist using where clause.
  • Added: API error message when using offset without limit
  • Fixed: Trying to get property 'id' of non-object error
  • Fixed: Disabled thumb field for non-image files in API responses.

Upgrading to v1.1.2

# Database

The database structure has been changed. You can apply the changes by following one of these options

Option 1 (using terminal)
  1. Replace the migration files
    database/migrations/2022_03_06_162012_add_disk_field_to_media_table.php
    database/migrations/2022_03_08_152849_add_disk_field_to_projects_table.php
  2. Open the terminal
  3. Go to your Elmapi folder
  4. Run the following command: php artisan migrate
Option 2 (manually)

Run following sql queries:

ALTER TABLE `media` ADD `disk` VARCHAR(10) NOT NULL DEFAULT 'local' AFTER `caption`;
ALTER TABLE `projects` ADD `disk` VARCHAR(10) NOT NULL DEFAULT 'local' AFTER `locales`;
# Replace the vendor folder

The vendor folder has been changed. You can apply the changes by following one of these options.

Option 1 (using composer)
  1. Replace the composer.json file
  2. Open the terminal
  3. Go to your Elmapi folder
  4. Run the following command: composer update
Option 2 (manually)

Replace the whole vendor folder with the new one.

# Replace the other files

Replace the following files:

app/Http/Controllers/API/ContentController.php
app/Http/Controllers/API/MediaController.php
app/Http/Controllers/CollectionsController.php
app/Http/Controllers/ContentController.php
app/Http/Controllers/MediaLibraryController.php
app/Http/Controllers/ProjectsController.php
app/Http/Resources/ContentResource.php
app/Http/Resources/MediaResource.php
app/Models/Media.php
app/Models/Project.php
public/css/app.css
public/js/app.js
public/js/partials/home.js
public/js/partials/profile.js
public/js/partials/project.collection.js
public/js/partials/project.collection.show.js
public/js/partials/project.content.edit.js
public/js/partials/project.content.js
public/js/partials/project.content.list.js
public/js/partials/project.content.new.js
public/js/partials/project.js
public/js/partials/project.media.js
public/js/partials/project.settings.api.js
public/js/partials/project.settings.js
public/js/partials/project.settings.locales.js
public/js/partials/project.settings.users.js
public/mix-manifest.json
resources/js/pages/Content/ContentEdit.vue
resources/js/pages/Content/ContentNew.vue
resources/js/pages/Content/ContentTable.vue
resources/js/pages/MediaLibrary.vue
resources/js/pages/Project/Settings.vue
routes/api.php
# Blog Example

There have been some changes to Blog Example. Replace the following files.

app\Http\Controllers\HomeController.php
resources\views\app.blade.php
resources\views\layout.blade.php
resources\views\page.blade.php
resources\views\post.blade.php

v1.0.0

Initial release