1. Go to this page and download the library: Download abdur-rahaman/laravel-seo 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/ */
abdur-rahaman / laravel-seo example snippets
use Abdurrahaman\LaravelSeo\DTOs\SeoData;
public function update(Request $request, Post $post)
{
$data = $request->validate([
'title' => ['
if (! empty($data['seo'])) {
$post->updateSeo(SeoData::fromArray($data['seo']));
}
return back()->with('success', 'Saved.');
}
namespace App\Models;
use Abdurrahaman\LaravelSeo\Support\HasSeo;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasSeo;
protected $fillable = ['title', 'slug', 'body'];
}