Initial Commit
This commit is contained in:
commit
ddf09fe00c
113 changed files with 187148 additions and 0 deletions
40
app/View/Components/CardText.php
Normal file
40
app/View/Components/CardText.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in a new issue