mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
seo image added
This commit is contained in:
@@ -21,18 +21,6 @@ class CommentBookCase extends Component
|
|||||||
|
|
||||||
public BookCase $bookCase;
|
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()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
@@ -55,12 +43,24 @@ class CommentBookCase extends Component
|
|||||||
return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]);
|
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)
|
protected function url_to_absolute($url)
|
||||||
{
|
{
|
||||||
if (str($url)->contains('http')) {
|
if (str($url)->contains('http')) {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
if (! str($url)->contains('http')) {
|
if (!str($url)->contains('http')) {
|
||||||
return str($url)->prepend('https://');
|
return str($url)->prepend('https://');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,28 +22,26 @@ class BookCase extends Model implements HasMedia
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that aren't mass assignable.
|
* The attributes that aren't mass assignable.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
'lat' => 'double',
|
'lat' => 'double',
|
||||||
'lon' => 'array',
|
'lon' => 'array',
|
||||||
'digital' => 'boolean',
|
'digital' => 'boolean',
|
||||||
'deactivated' => 'boolean',
|
'deactivated' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::creating(function ($model) {
|
static::creating(function ($model) {
|
||||||
if (! $model->created_by) {
|
if (!$model->created_by) {
|
||||||
$model->created_by = auth()->id();
|
$model->created_by = auth()->id();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -60,6 +58,10 @@ class BookCase extends Model implements HasMedia
|
|||||||
->addMediaConversion('preview')
|
->addMediaConversion('preview')
|
||||||
->fit(Manipulations::FIT_CROP, 300, 300)
|
->fit(Manipulations::FIT_CROP, 300, 300)
|
||||||
->nonQueued();
|
->nonQueued();
|
||||||
|
$this->addMediaConversion('seo')
|
||||||
|
->fit(Manipulations::FIT_CROP, 1200, 630)
|
||||||
|
->width(1200)
|
||||||
|
->height(630);
|
||||||
$this->addMediaConversion('thumb')
|
$this->addMediaConversion('thumb')
|
||||||
->fit(Manipulations::FIT_CROP, 130, 130)
|
->fit(Manipulations::FIT_CROP, 130, 130)
|
||||||
->width(130)
|
->width(130)
|
||||||
|
|||||||
Reference in New Issue
Block a user