mirror of
https://github.com/archtechx/laravel-seo.git
synced 2025-12-13 18:24:04 +00:00
Directive support for Flipp
This commit is contained in:
parent
2dc7b7048e
commit
6b575dec29
2 changed files with 18 additions and 0 deletions
|
|
@ -25,16 +25,26 @@ class SEOServiceProvider extends ServiceProvider
|
|||
], 'seo-views');
|
||||
|
||||
BladeHelper::directive('seo', function (...$args) {
|
||||
// Flipp supports more arguments
|
||||
if ($args[0] === 'flipp') {
|
||||
array_shift($args);
|
||||
|
||||
return seo()->flipp(...$args);
|
||||
}
|
||||
|
||||
// Two arguments indicate that we're setting a value, e.g. `@seo('title', 'foo')
|
||||
if (count($args) === 2) {
|
||||
return seo()->set($args[0], $args[1]);
|
||||
}
|
||||
|
||||
// An array means we don't return anything, e.g. `@seo(['title' => 'foo'])
|
||||
if (is_array($args[0])) {
|
||||
seo($args[0]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// A single value means we fetch a value, e.g. `@seo('title')
|
||||
return seo()->get($args[0]);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue