Finish share button and added gallery buttons
This commit is contained in:
41
app/View/Components/ShareRhpzUrl.php
Normal file
41
app/View/Components/ShareRhpzUrl.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\News;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class ShareRhpzUrl extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public Entry|News $entry,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
if( ( $this->entry->type ?? "news" ) === 'news' ){
|
||||
$letter = 'n';
|
||||
} else {
|
||||
$letter = $this->entry->type[0];
|
||||
}
|
||||
|
||||
$id = $this->entry->id;
|
||||
$shareUrl = config('app.share_url');
|
||||
|
||||
$url = rtrim($shareUrl, '/') . '/' . $letter . '/' . $id;
|
||||
|
||||
return view('components.share-rhpz-url', compact('url') );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user