From 843b260021be6acaa164b77ba08ee1e94bff7e3e Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Fri, 20 Oct 2023 12:01:23 +0300 Subject: [PATCH] fix user role --- app/Http/Controllers/Dashboard/UserController.php | 2 +- app/Models/Project.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Dashboard/UserController.php b/app/Http/Controllers/Dashboard/UserController.php index aecfb861..95a51803 100644 --- a/app/Http/Controllers/Dashboard/UserController.php +++ b/app/Http/Controllers/Dashboard/UserController.php @@ -46,10 +46,10 @@ public function store(Request $request): RedirectResponse [ 'name' => $attributes['name'], 'created_by' => auth()->user()->id, - 'role' => UserRole::MANAGER, ] ); + $user->role=UserRole::MANAGER; $user->organization() ->associate(auth()->user()->organization) ->save(); diff --git a/app/Models/Project.php b/app/Models/Project.php index 2b6a417e..b93df2ef 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -275,12 +275,14 @@ public function getEmbeddedVideosAttribute(): array return $embeddedVideos; } - public function scopeSearch(Builder $query, ?string $search): Builder { + public function scopeSearch(Builder $query, ?string $search): Builder + { if (empty($search)) { return $query; } $search = trim($search); $search = strip_tags($search); + return $query->where('name', 'like', "%{$search}%"); } }