webid/cms-nova

There is no license information available for the latest version (dev-main) of this package.

CMS for Laravel with Nova

dev-main 2023-11-22 14:43 UTC

This package is auto-updated.

Last update: 2024-10-11 11:59:36 UTC


README

MIT Licence Logo

Table of contents

Requirements

  • PHP >= 8.2
  • Laravel >= 9
  • Nova >= 4
  • Composer 2
  • MariaDB / MySQL

Installation

1. Install the package

This package can be installed as a Composer dependency.

"repositories": [
    {
        "type": "vcs",
        "url" : "git@github.com:web-id-fr/cms-nova.git"
    }
]
composer require webid/cms-nova

2. Publish files

Case 1 : First install

php artisan vendor:publish --provider="Webid\CmsNova\CmsServiceProvider" --force

Case 2 : Second install (or after)

php artisan vendor:publish --provider="Webid\CmsNova\CmsServiceProvider"

3. Install databases

make install_db

4. Add nova-components in composer

"extra": {
    "laravel": {
        "dont-discover": [],
        "providers": [
            "Webid\\ComponentTool\\ToolServiceProvider"
        ]
    }
}
"autoload": {
    "psr-4": {
        "Webid\\ComponentTool\\" : "nova-components/ComponentTool/src/"
    },
},
"require": {
    "webid/component-item-field": "*",
},

"repositories": [
    {
        "type": "path",
        "url": "./nova-components/ComponentItemField"
    }
]

Then run composer update

5. Prepare routes

You have to remove all routes from your routes/web.php file to make sure the cms will work properly.

If the project is a fresh Laravel project, you may have some generated code like this to remove :

Route::get('/', function () {
    return view('welcome');
});

6. Link storage files

Run command php artisan storage:link.

7. Configure sitemap.xml

If you want to allow robots to access your sitemap, add this line in the robots.txt file :

Sitemap: https://www.your-domain.com/sitemap.xml

⚠ Replace www.your-domain.com by your actual website domain.

#f03c15 ⚠ ⚠ Do not delete existing code in nova-components !!! ⚠ ⚠ #f03c15

Customization

Disable robots follow

To disable the tracking of robots, you must add in the .env DISABLE_ROBOTS_FOLLOW=true

Use form

js

do not modify the file send_form.js ! Edit the helper.js file with the form front information to display errors and the success message. Added to package.json :

"dropzone": "^5.7.0",
"lang.js": "^1.1.14"

In the webpack.mix file, add the send_form_js file. The file is already linked in the front.

front-end

You can change the form frontend but DO NOT TOUCH the submit_form class for sending forms.

Internationalization

Don't forget to create a service to display the languages as you need them. Use this service into a ViewServiceProvider to share both languages and translated slugs to views.

To create the service provider, you can run :

php artisan make:provider ViewServiceProvider

⚠ Don't forget to add the service provider in the file config/app.php.

Update email template

Template email in resources/views/mail/form.blade.php

You can change the design of the mail template but do not delete or modify the existing code! The present code allows you to display the fields of the form sent in the email.

Add images for components

public/cms/images/components/gallery_component.png
public/cms/images/components/newsletter_component.png

Extending functionalities

Create a new component

1. create Models, migration, repositories, Nova, Resource for the new component (register all elements in a Components folder)
2. update config\component.php with the information of the new component and add the image of the component in public/components/
3. update App\Models\Template with the information of the new component
4. update Services\ComponentsService.php with the information of the new component
5. update nova-components\ComponentField with the information of the new component

Modules

Module form

1. Add in your .env file the SEND_EMAIL_CONFIRMATION key, to send or not to send a confirmation email