seo image added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-16 19:18:07 +01:00
parent 400c2db26e
commit ce2102c0e3
2 changed files with 22 additions and 20 deletions

View File

@@ -21,18 +21,6 @@ class CommentBookCase extends Component
public BookCase $bookCase;
public function render()
{
return view('livewire.book-case.comment-book-case')
->layout('layouts.app', [
'SEOData' => new SEOData(
title: $this->bookCase->title,
description: $this->bookCase->address,
image: $this->bookCase->getFirstMediaUrl('images') ?? asset('img/bookcase.jpg'),
),
]);
}
public function save()
{
$this->validate([
@@ -55,6 +43,18 @@ class CommentBookCase extends Component
return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]);
}
public function render()
{
return view('livewire.book-case.comment-book-case')
->layout('layouts.app', [
'SEOData' => new SEOData(
title: $this->bookCase->title,
description: $this->bookCase->address,
image: $this->bookCase->getFirstMediaUrl('images', 'seo') ?? asset('img/bookcase.jpg'),
),
]);
}
protected function url_to_absolute($url)
{
if (str($url)->contains('http')) {

View File

@@ -22,14 +22,12 @@ class BookCase extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
@@ -60,6 +58,10 @@ class BookCase extends Model implements HasMedia
->addMediaConversion('preview')
->fit(Manipulations::FIT_CROP, 300, 300)
->nonQueued();
$this->addMediaConversion('seo')
->fit(Manipulations::FIT_CROP, 1200, 630)
->width(1200)
->height(630);
$this->addMediaConversion('thumb')
->fit(Manipulations::FIT_CROP, 130, 130)
->width(130)