Open
Description
I am on laravel 9 in my show blade I am trying to display any URL posted by a user here is my code
in my livewire post show blade I did this if I create a post with a link the is not previewing in my show view page , I have tried to different URL still not working
public function mount (Post $post)
{
$this->post = $post;
preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $post->body, $matches);
$this->urlDetails = collect($matches[0])->map(function ($url) {
$embed = new Embed();
$info = $embed->get($url);
return ['info' => $info, 'title' => $info->title];
})->all();
}
getting the URL like this in my show blade view
{{ $urlDetails['title'] ?? '' }}
but it's not working
Metadata
Metadata
Assignees
Labels
No labels