1. Go to this page and download the library: Download yaroslawww/nova-seo-entity library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yaroslawww / nova-seo-entity example snippets
public function up()
{
Schema::create(config('nova-seo-entity.table'), function (Blueprint $table) {
\NovaSeoEntity\Database\MigrationHelper::defaultColumns($table);
});
}
public function down()
{
Schema::dropIfExists(config('nova-seo-entity.table'));
}
class Article extends Model implements \NovaSeoEntity\Contracts\WithSeoEntity
{
use \NovaSeoEntity\Models\Traits\HasSeoEntity;
// ...
/**
* Example how set default value for nova "creation" screen
*/
public function getNewInstanceSeoValueForDescription( ): ?string {
return Str::limit( WysiwygHelper::html2Text( $this->content ), 150 );
}
/**
* Override canonical value if not set
*/
public function getSEOCanonicalFieldValue( mixed $value ): mixed {
return $value ?: ($this->slug ? route( 'front.article.single', $this->slug ) : null);
}
}
$article = Article::find($articleId);
// Get seoinfo with default value
$article?->seo_info_forced->seoPrepare();
// Get seoinfo without defaults
// $article?->seo_info?->seoPrepare();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.