Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
felixgilles committed Jan 17, 2024
1 parent 27e1dc8 commit 68a4680
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,37 @@ class HasMetaModel extends Resource

#### Front

You can use de Facade ModelHasMeta to display the meta of a model.

In your controller :

```php
class HasModelController extends Controller
{
public function show($id)
{
$model = HasMetaModel::find($id);
ModelHasMeta::setModel($model);

return view('has-meta', compact('model'));
}
}
```

In the view :

```php
@section('metas')
{{ \Novius\LaravelMeta\Facades\ModelHasMeta::renderMeta() }}
@endsection

<x-main-layout>
<div class="container mx-auto px-4 md:px-0">
<h1>{{ $model->title }}</h1>
<p>{{ $model->description }}</p>
</div>
</x-main-layout>
```

### Testing

Expand Down

0 comments on commit 68a4680

Please sign in to comment.