From 32f8f9faeb32e121363d3d020e4576a6731e7429 Mon Sep 17 00:00:00 2001 From: Pavel Mironchik Date: Tue, 26 Jan 2021 12:44:12 +0600 Subject: [PATCH] Allow to use custom warning about existing relations in modules. --- app/Traits/Relationships.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Traits/Relationships.php b/app/Traits/Relationships.php index b220037ba..b73e7cc11 100644 --- a/app/Traits/Relationships.php +++ b/app/Traits/Relationships.php @@ -3,6 +3,7 @@ namespace App\Traits; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Support\Str; trait Relationships { @@ -15,7 +16,8 @@ trait Relationships continue; } - $counter[] = $c . ' ' . strtolower(trans_choice('general.' . $text, ($c > 1) ? 2 : 1)); + $text = Str::contains($text, '::') ? $text : 'general.' . $text; + $counter[] = $c . ' ' . strtolower(trans_choice($text, ($c > 1) ? 2 : 1)); } return $counter;