Pharaonic
Loading...

Load From Model

OLD VERSION

WARNING : You're browsing the documentation for an old version of SEO. Consider upgrading your project to 2.x

Load From Model

# Inclusion

You have to add toSEO method to your model and specify your columns.

1namespace App\Models;
2 
3use Illuminate\Database\Eloquent\Model;
4 
5class Persion extends Model
6{
7 protected $fillable = ['name', 'bio', 'age', 'country'];
8 
9 public function toSEO()
10 {
11 return [
12 'columns' => [
13 'title' => 'name',
14 'description' => 'bio',
15 ],
16 
17 'meta' => [ // Customized data
18 'theme-color' => '#4285f4'
19 ],
20 
21 'og' => [ // Customized Open-Graph data
22 'type' => 'website'
23 ],
24 
25 'twitter' => [ // Customzied Twitter data
26 'card' => 'summary'
27 ]
28 ];
29 }
30}

# Model-SEO Injection

Just inject the model SEO in the SEO collector to generate it on the page later.

1$person = Person::first();
2seo()->model($person);