Dustin Cox

Results 20 comments of Dustin Cox

Steps we did to fix this issue - After login set users session team_id to there assigned id. - Make a Teams model that extends the VentureDrake Team model Set...

Create middleware - app/Http/Middleware/CheckCustomPermission.php `namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; class CheckCustomPermission { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next *...

Edit User Model `use VentureDrake\LaravelCrm\Models\Team; public function team() { return $this->belongsTo(Team::class); } public function canForTeam($permission, $teamId) { $team = Teams::find($teamId); if ($this->team_id == $teamId) { $teamPermissions = $team->permissions->pluck('name')->toArray(); if (in_array($permission,...

Update app/Providers/AuthServiceProvider.php ` public function boot() { $this->registerPolicies(); // List of permissions $permissions = \DB::table('permissions')->pluck('name'); foreach ($permissions as $permission) { Gate::define($permission, function ($user) use ($permission) { // Direct permission check...

(config('laravel-crm.teams') && auth()->user()->currentTeam && auth()->user()->currentTeam->user_id == auth()->user()->id currentTeam function was not working so I update it like so elseif (config('laravel-crm.teams') && auth()->user()->team->user_id == auth()->user()->id && ! auth()->user()->hasRole('Owner')) { and on...

For the middle ware to work each one needs to check if (Env::get('LARAVEL_CRM_TEAMS')) { return $user->canForTeam('view crm fields', $user->team_id); }

once you attach permissions to a team you will start seeing the nav bar

by adding this to you policy you don't have to update your routes I am going to post this to our clean crm project. It is public. Also, because our...

https://github.com/Lemnocity/clean-crm here is the link to our clean crm project