-
Run
composer require despark/igni-seo
-
Add igniCMS SEO module service providers before the application service providers in the
config/app.php
, as shown below (Optional for Laravel 5.5)
Example
...
/*
* igniCMS Service Providers
*/
Despark\Cms\Seo\Providers\IgniSeoServiceProvider::class,
/*
* Package Service Providers...
*/
Laravel\Tinker\TinkerServiceProvider::class,
...
-
Run
php artisan vendor:publish --provider="Despark\Cms\Seo\Providers\IgniSeoServiceProvider"
. If you are using Laravel 5.3|5.4, replace--provider
with--class
. -
Run
php artisan migrate
to add our seo table to your database. -
In your entity file add the following code in your
adminFormsField
:
'content' => [
'type' => 'wysiwyg',
'label' => 'Content',
],
'readability' => [
'type' => 'readability',
'for' => 'content', // This field is optional. Use it only if your column, that is going to be checked for readability, is not called content
'editorPosition' => 0, // The position of the desired editor, if you have more than one wysiwygs
],
'seo' => [
'type' => 'seo',
'routeName' => 'articles.show',
'meta_title_field' => 'title', // This field is optional. Use it only if your column, which is going to be checked is not called title
],
- Add our Traits and Interfaces to your Model.
use Despark\Cms\Admin\Interfaces\UploadImageInterface;
use Despark\Cms\Admin\Traits\AdminImage;
use Despark\Cms\Models\AdminModel;
use Despark\Cms\Seo\Contracts\Seoable;
use Despark\Cms\Seo\Traits\HasSeo;
class Article extends AdminModel implements Seoable, UploadImageInterface
{
use HasSeo;
use AdminImage;
protected $table = 'articles';
protected $fillable = [
'title',
'slug',
'content',
];
protected $rules = [
'title' => 'required',
'slug' => 'required',
'content' => 'required',
];
protected $identifier = 'article';
}
$seoData = $model->seo;
igniCMS was written by Despark for the Laravel framework and is released under the MIT License. See the LICENSE file for details.