Merge branch 'ticket962' into chromefixes
+ Add credit log check client has brands
This commit is contained in:
commit
3971b4b2fc
4 changed files with 17 additions and 9 deletions
|
|
@ -43,13 +43,6 @@ class AccountController extends Controller
|
|||
|
||||
if (!$user->isAdmin()) {
|
||||
$userBrands = $user->brands();
|
||||
if (!$userBrands->count()) {
|
||||
\redirect()->route('ticket.index')->withErrors(['warning' => trans(
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'Pour utiliser cette fonctionnalité vous devez appartenir à une marque, merci d\'en faire la demande à :mail',
|
||||
['mail' => collect(config('mail.contactsList.serviceweb'))->implode(' ')]
|
||||
)])->throwResponse();
|
||||
}
|
||||
return $query->whereHas('brand', function ($q) use ($userBrands) {
|
||||
$q->whereIn('brand_id', $userBrands->pluck('id'));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,11 @@ class User extends Authenticatable
|
|||
*/
|
||||
protected $crudValueColumn = 'id';
|
||||
|
||||
// stores unhashed pwd
|
||||
/**
|
||||
* stores unhashed pwd
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $tmpPass = null;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -74,8 +74,17 @@ class RouteServiceProvider extends ServiceProvider
|
|||
|
||||
return Account::where('id', \intval($value))->firstOrFail();
|
||||
});
|
||||
Route::model('credit_log', function ($value) {
|
||||
/** @var \App\Models\User|null */
|
||||
if (!($user = \auth()->user())) {
|
||||
abort(401);
|
||||
}
|
||||
|
||||
$this->assertClientHasBrands($user);
|
||||
|
||||
return CreditLog::where('id', \intval($value))->firstOrFail();
|
||||
});
|
||||
Route::model('brand', Brand::class);
|
||||
Route::model('credit_log', CreditLog::class);
|
||||
Route::model('label', Label::class);
|
||||
Route::model('marker', Marker::class);
|
||||
Route::model('file', File::class);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@if(request()->brand)
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<span class="fw-bold h4">{{ __('Marque')}}</span>
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
<b class="h4">{{ optional(request()->brand)->name }}</b>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
@include('crud-policies::crud.modules.sorter')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue