File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 66
77interface HasSeo
88{
9- public function getSeo ( ): SeoManager ;
9+ public function applySeo ( SeoManager $ manager ): SeoManager ;
1010}
Original file line number Diff line number Diff line change 33namespace Elegantly \Seo ;
44
55use Closure ;
6+ use Elegantly \Seo \Concerns \HasSeo ;
67use Elegantly \Seo \Contracts \Taggable ;
78use Elegantly \Seo \OpenGraph \Locale ;
89use Elegantly \Seo \OpenGraph \OpenGraph ;
@@ -43,6 +44,25 @@ public function current(): static
4344 return $ this ;
4445 }
4546
47+ public function apply (HasSeo $ class ): self
48+ {
49+ return $ class ->applySeo ($ this );
50+ }
51+
52+ /**
53+ * @return $this
54+ */
55+ public function set (SeoManager $ manager ): static
56+ {
57+ return $ this
58+ ->setStandard ($ manager ->standard )
59+ ->setOpengraph ($ manager ->opengraph )
60+ ->setTwitter ($ manager ->twitter )
61+ ->setWebpage ($ manager ->webpage )
62+ ->setSchemas ($ manager ->schemas )
63+ ->setCustomTags ($ manager ->customTags );
64+ }
65+
4666 /**
4767 * @param null|Standard|(Closure(Standard):(null|Standard)) $value
4868 * @return $this
@@ -118,6 +138,21 @@ public function setSchemas(null|array|Closure $value): static
118138 return $ this ;
119139 }
120140
141+ /**
142+ * @param null|SeoTags|(Closure(SeoTags):(null|SeoTags)) $value
143+ * @return $this
144+ */
145+ public function setCustomTags (null |SeoTags |Closure $ value ): static
146+ {
147+ if ($ value instanceof Closure) {
148+ $ this ->customTags = $ value ($ this ->customTags ?? new SeoTags );
149+ } else {
150+ $ this ->customTags = $ value ;
151+ }
152+
153+ return $ this ;
154+ }
155+
121156 /**
122157 * @return $this
123158 */
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ function seo(null|HasSeo|SeoManager $value = null): SeoManager
1111 }
1212
1313 if ($ value instanceof HasSeo) {
14- return $ value -> getSeo ( );
14+ return \ Elegantly \ Seo \ Facades \SeoManager:: current ()-> apply ( $ value );
1515 }
1616
1717 return $ value ;
You can’t perform that action at this time.
0 commit comments