public function show($slug, LaboArticleRepository $repository)
{
+ /** @var LaboArticle $actu */
$actu = $repository->forSlug($slug);
\View::share('title', $actu->title);
\View::share('actu', $actu);
+ \View::share('meta', $actu->getMetaData());
return view('actu-labos.show');
}
public function show($slug, AdCampaignRepository $repository)
{
+ /** @var AdCampaign $campaign */
$campaign = $repository->forSlug($slug);
\View::share('campaign', $campaign);
\View::share('title', $campaign->title);
+ \View::share('meta', $campaign->getMetaData());
return view('com-campaigns.show');
* Class AdCampaign
* @package App\Models
* @property string $url
+ * @property string $title
+ * @property string $description
+ * @property string $content
+ *
*/
class AdCampaign extends Model implements Sortable, PillBoxContract
{
use HasSlug, HasMedias, HasPosition, HasSubscriberOnlyContent;
- use Searchable;
+ use Searchable, HasMetaTags;
protected $fillable = [
'published',
'ratio' => 0,
],
],
+ 'social' => [
+ [
+ 'name' => 'Social',
+ 'ratio' => 1,
+ ],
+ ],
],
];
{
return route('com-campaign.show', ['slug' => $this->slug]) ?? '#';
}
+
+ /**
+ * @return string
+ */
+ protected function getMetaDescription(): string
+ {
+ return $this->description;
+ }
+
+ protected function getMetaImage(): string
+ {
+ return $this->image('image', 'social', [], true) ??
+ $this->image('image', 'preview');
+ }
}
{
return [
'title' => $this->getMetaTitle(),
- 'description' => $this->getMetaDescription(),
+ 'description' => strip_tags($this->getMetaDescription()),
'image' => $this->getMetaImage(),
'url' => $this->getMetaUrl(),
];
protected function getMetaDescription(): string
{
- return strip_tags($this->chapo);
+ return $this->chapo;
}
protected function getMetaImage(): string
*/
class LaboArticle extends Model implements Sortable, PillBoxContract
{
- use HasSlug, HasMedias, HasPosition, HasSubscriberOnlyContent;
+ use HasSlug, HasMedias, HasPosition, HasSubscriberOnlyContent, HasMetaTags;
protected $fillable = [
'publish_start_date',
'ratio' => 0,
],
],
+ 'social' => [
+ [
+ 'name' => 'social',
+ 'ratio' => 1,
+ ]
+ ]
],
];
return route('actus-labos.show', ['slug' => $this->slug]);
}
+ /**
+ * @return string
+ */
+ protected function getMetaDescription(): string
+ {
+ return $this->preview;
+ }
+
+
+ /**
+ * @return string
+ */
+ protected function getMetaImage(): string
+ {
+ return $this->image('image', 'social', [], true) ??
+ $this->image('image');
+ }
+
}