Archived
1
0
Fork 0

Initial Commit

This commit is contained in:
Henrik Hautakoski 2021-10-18 11:53:33 +02:00
commit ddf09fe00c
113 changed files with 187148 additions and 0 deletions

View file

@ -0,0 +1,40 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use App\Models\Card;
class CardText extends Component
{
protected Card $card;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(Card $card)
{
$this->card = $card;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
$subject = preg_quote(__($this->card->subject));
// Replace non escaped '?' with subject and also Unescape escaped '?'
$text = preg_replace(
['/(?<!\\\\)\?/u', '/\\\\\\?/u'] ,
["<strong>$subject</strong>", '?'],
$this->card->body);
return $text;
}
}