├── .gitignore ├── LICENSE ├── README.md ├── composer.json └── src ├── .DS_Store ├── Config └── teamrole.php ├── Controllers ├── AdminTeamRoleController.php ├── TeamRoleController.php └── TeamRoleMembersController.php ├── Database ├── .DS_Store └── migrations │ └── 2016_11_13_134303_create_role_for_teams_tables.php ├── Listeners └── JoinedTeamListener.php ├── Models └── TeamRole.php ├── Routes └── web.php ├── TeamRoleDemoProvider.php ├── TeamRoleProvider.php ├── Traits ├── .DS_Store └── UsedByUsers.php └── Views ├── admin ├── create.blade.php ├── edit.blade.php └── index.blade.php ├── create.blade.php ├── edit.blade.php ├── index.blade.php └── members ├── edit.blade.php └── list.blade.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | node_modules/ 3 | .DS_Store 4 | 5 | # Laravel 4 specific 6 | bootstrap/compiled.php 7 | app/storage/ 8 | 9 | # Laravel 5 & Lumen specific 10 | bootstrap/cache/ 11 | .env.*.php 12 | .env.php 13 | .env 14 | 15 | # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer 16 | .rocketeer/ 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Michael Pivonka 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Team Roles for mpociot/teamwork 2 | 3 | ## Installation 4 | 5 | This package is very easy to setup and install. 6 | 7 | ### Composer 8 | 9 | Pull this package in through Composer (file `composer.json`). 10 | 11 | ```js 12 | { 13 | "require": { 14 | "tehcodedninja/teamroles": "1.0.3-alpha" 15 | } 16 | } 17 | ``` 18 | The run `composer install` or `composer update`. 19 | Alternatively you can run `composer require tehcodedninja/teamroles` to install this package. 20 | 21 | ### Service Provider 22 | 23 | Add the package to your application service providers in `config/app.php` file. 24 | 25 | ```php 26 | 'providers' => [ 27 | 28 | /* 29 | * Laravel Framework Service Providers... 30 | */ 31 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class, 32 | Illuminate\Auth\AuthServiceProvider::class, 33 | ... 34 | 35 | /** 36 | * Third Party Service Providers... 37 | */ 38 | Tehcodedninja\Teamroles\TeamRoleProvider::class, 39 | ], 40 | ``` 41 | 42 | ### Config File And Migrations 43 | 44 | Publish the package config file and migrations to your application. Run these commands inside your terminal. 45 | 46 | php artisan vendor:publish --provider="Tehcodedninja\Teamroles\TeamRoleProvider" --tag=config 47 | php artisan vendor:publish --provider="Tehcodedninja\Teamroles\TeamRoleProvider" --tag=migrations 48 | 49 | And also run migrations. 50 | 51 | php artisan migrate 52 | 53 | ### Models 54 | 55 | #### User 56 | 57 | Add the `UsedByUsers` trait to your existing User model: 58 | 59 | ```php 60 | [ 86 | 87 | /* 88 | * Laravel Framework Service Providers... 89 | */ 90 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class, 91 | Illuminate\Auth\AuthServiceProvider::class, 92 | ... 93 | 94 | /** 95 | * Third Party Service Providers... 96 | */ 97 | Tehcodedninja\Teamroles\TeamRoleDemoProvider::class, 98 | ], 99 | ``` 100 | 101 | Adding this service provider links all the Models/Views/Controllers to you application without moving anything. 102 | 103 | The demo provides you everything like TeamWork does but with the ability to assign roles to people for each team: 104 | 105 | * Team listing 106 | * Team creation / editing / deletion 107 | * Invite new members to teams 108 | * Team Role creation / editing / deletion 109 | * Change members' role 110 | 111 | To get started, take a look at the new installed `/teamroles` and `/admin/teamroles` in your project. 112 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tehcodedninja/teamroles", 3 | "type": "library", 4 | "description": "Team Roles expansion on mpociot/teamwork", 5 | "keywords": ["teamwork","teamroles","roles"], 6 | "homepage": "https://github.com/tehcodedninja/TeamRoles", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Michael Pivonka", 11 | "email": "m.pivonka@codedninja.com", 12 | "homepage": "http://codedninja.com/", 13 | "role": "Developer" 14 | } 15 | ], 16 | "autoload": { 17 | "psr-0": { 18 | "Tehcodedninja\\Teamroles": "src/" 19 | } 20 | }, 21 | "minimum-stability": "dev", 22 | "require": { 23 | "mpociot/teamwork": "~4.0", 24 | "laravel/framework": "~5.3" 25 | } 26 | } -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedninja/TeamRoles/7e7c24f69fc623593e84a11827019c3a771552d2/src/.DS_Store -------------------------------------------------------------------------------- /src/Config/teamrole.php: -------------------------------------------------------------------------------- 1 | 3, // Member 5 | 'default_owner_role'=> 1 // Owner 6 | ]; -------------------------------------------------------------------------------- /src/Controllers/AdminTeamRoleController.php: -------------------------------------------------------------------------------- 1 | with('roles', $roles); 16 | } 17 | 18 | function create() 19 | { 20 | return view('teamroles::admin.create'); 21 | } 22 | 23 | function store(Request $request) 24 | { 25 | TeamRole::create([ 26 | 'name' => $request->name, 27 | 'label' => $request->label 28 | ]); 29 | 30 | return redirect(route('admin.teamroles.index')); 31 | } 32 | 33 | function edit($id) 34 | { 35 | $team_role = TeamRole::findOrFail($id); 36 | 37 | return view('teamroles::admin.edit') 38 | ->with('team_role', $team_role); 39 | } 40 | 41 | function update(Request $request, $id) 42 | { 43 | $team_role = TeamRole::findOrFail($id); 44 | $team_role->name = $request->name; 45 | $team_role->label = $request->label; 46 | $team_role->save(); 47 | 48 | return redirect(route('admin.teamroles.index')); 49 | } 50 | 51 | function destroy($id) 52 | { 53 | $team_role = TeamRole::findOrFail($id); 54 | $team_role->delete(); 55 | 56 | return redirect(route('admin.teamroles.index')); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Controllers/TeamRoleController.php: -------------------------------------------------------------------------------- 1 | teams; 16 | return view('teamroles::index')->with('teams', $teams); 17 | } 18 | 19 | function create() 20 | { 21 | return view('teamroles::create'); 22 | } 23 | 24 | function store(Request $request) 25 | { 26 | $team = Team::create([ 27 | 'name' => $request->name, 28 | 'owner_id' => $request->user()->id 29 | ]); 30 | 31 | $request->user()->attachTeam($team); 32 | $request->user()->updateTeamRole(1, $team); // Attach User as the owner of the group 33 | 34 | return redirect(route('teamroles.index')); 35 | } 36 | 37 | function edit($id) 38 | { 39 | $team = Team::findOrFail($id); 40 | 41 | if (! Auth::user()->isOwnerOfTeam($team)) { 42 | abort(403); 43 | } 44 | 45 | return view('teamroles::edit')->with('team', $team); 46 | } 47 | 48 | function update(Request $request, $id) 49 | { 50 | $team = Team::findOrFail($id); 51 | 52 | if (! Auth::user()->isOwnerOfTeam($team)) { 53 | abort(403); 54 | } 55 | 56 | $team->name = $request->name; 57 | $team->save(); 58 | 59 | return redirect(route('teamroles.index')); 60 | } 61 | 62 | function destroy($id) 63 | { 64 | $team = Team::findOrFail($id); 65 | 66 | if (! Auth::user()->isOwnerOfTeam($team)) { 67 | abort(403); 68 | } 69 | 70 | $team->delete(); 71 | 72 | User::where('current_team_id', $id) 73 | ->update(['current_team_id' => null]); 74 | 75 | return redirect(route('teamroles.index')); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Controllers/TeamRoleMembersController.php: -------------------------------------------------------------------------------- 1 | with('team', $team); 18 | } 19 | 20 | function edit($team_id, $user_id) 21 | { 22 | $team = Team::findOrFail($team_id); 23 | $user = User::findOrFail($user_id); 24 | $roles = TeamRole::where('id', '!=', Config::get('teamroles.default_owner_role'))->get(); 25 | 26 | return view('teamroles::members.edit') 27 | ->with('team', $team) 28 | ->with('user', $user) 29 | ->with('roles', $roles); 30 | } 31 | 32 | function update(Request $request, $team_id, $user_id) 33 | { 34 | $team = Team::findOrFail($team_id); 35 | $user = User::findOrFail($user_id); 36 | 37 | $user->updateTeamRole($request->role, $team); 38 | 39 | return redirect(route('teamroles.members.show', $team_id)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Database/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedninja/TeamRoles/7e7c24f69fc623593e84a11827019c3a771552d2/src/Database/.DS_Store -------------------------------------------------------------------------------- /src/Database/migrations/2016_11_13_134303_create_role_for_teams_tables.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('label')->nullable(); 20 | $table->timestamps(); 21 | }); 22 | 23 | // Add default roles 24 | Tehcodedninja\Teamroles\Models\TeamRole::create(['name'=>'Owner', 'label'=>'owner']); 25 | Tehcodedninja\Teamroles\Models\TeamRole::create(['name'=>'Admin', 'label'=>'admin']); 26 | Tehcodedninja\Teamroles\Models\TeamRole::create(['name'=>'Member', 'label'=>'member']); 27 | 28 | // Add team role id to team user table 29 | Schema::table(\Config::get( 'teamwork.team_user_table' ), function (Blueprint $table) { 30 | $table->integer('team_role_id')->unsigned()->default(\Config::get( 'teamroles.default_team_role')); 31 | }); 32 | 33 | // Add team owner's to role table and give default role 34 | App\Team::all()->each(function($team){ 35 | $users = $team->users; 36 | 37 | foreach($users as $user) 38 | { 39 | // Legacy isOwnerOfTeam($team) 40 | $team_model = Config::get( 'teamwork.team_model' ); 41 | $team_key_name = ( new $team_model() )->getKeyName(); 42 | $isOwnerOfTeam = ( ( new $team_model ) 43 | ->where( "owner_id", "=", $user->getKey() ) 44 | ->where( $team_key_name, "=", $team->id )->first() 45 | ) ? true : false; 46 | 47 | // Check if owner 48 | if($isOwnerOfTeam) 49 | { 50 | // Add Owner role to team's Owner 51 | $user->changeTeamRole(\Config::get( 'teamroles.default_owner_role'), $team->id); 52 | } 53 | } 54 | }); 55 | } 56 | 57 | /** 58 | * Reverse the migrations. 59 | * 60 | * @return void 61 | */ 62 | public function down() 63 | { 64 | Schema::table(\Config::get( 'teamwork.team_user_table' ), function ($table) { 65 | $table->dropColumn('team_role_id'); 66 | }); 67 | Schema::dropIfExists('team_roles'); 68 | } 69 | } -------------------------------------------------------------------------------- /src/Listeners/JoinedTeamListener.php: -------------------------------------------------------------------------------- 1 | getUser(); 28 | $team_id = $event->getTeamId(); 29 | 30 | // Do something with the user and team ID. 31 | $user->updateTeamRole(\Config::get( 'teamroles.default_owner_role'), $team_id) 32 | } 33 | } -------------------------------------------------------------------------------- /src/Models/TeamRole.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\User'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Routes/web.php: -------------------------------------------------------------------------------- 1 | 'admin/teamroles', 'middleware'=>'auth'], function() { 4 | // Admin of all team roles 5 | Route::get('/', 'AdminTeamRoleController@index')->name('admin.teamroles.index'); 6 | Route::get('create', 'AdminTeamRoleController@create')->name('admin.teamroles.create'); 7 | Route::post('create', 'AdminTeamRoleController@store')->name('admin.teamroles.store'); 8 | Route::get('{id}/edit', 'AdminTeamRoleController@edit')->name('admin.teamroles.edit'); 9 | Route::put('{id}/edit', 'AdminTeamRoleController@update')->name('admin.teamroles.update'); 10 | Route::delete('{id}/destroy', 'AdminTeamRoleController@destroy')->name('admin.teamroles.destroy'); 11 | }); 12 | 13 | Route::group(['prefix' => 'teamroles', 'middleware'=>'auth'], function() { 14 | // Team Routes 15 | Route::get('/', 'TeamRoleController@index')->name('teamroles.index'); 16 | Route::get('/create', 'TeamRoleController@create')->name('teamroles.create'); 17 | Route::post('/create', 'TeamRoleController@store')->name('teamroles.store'); 18 | Route::get('{id}/edit', 'TeamRoleController@edit')->name('teamroles.edit'); 19 | Route::put('{id}/edit', 'TeamRoleController@update')->name('teamroles.update'); 20 | Route::put('{id}/destroy', 'TeamRoleController@destroy')->name('teamroles.destroy'); 21 | 22 | // Member Routes 23 | Route::get('{id}/members', 'TeamRoleMembersController@show')->name('teamroles.members.show'); 24 | Route::get('{team_id}/members/{user_id}/edit', 'TeamRoleMembersController@edit')->name('teamroles.members.edit'); 25 | Route::put('{team_id}/members/{user_id}/edit', 'TeamRoleMembersController@update')->name('teamroles.members.update'); 26 | }); -------------------------------------------------------------------------------- /src/TeamRoleDemoProvider.php: -------------------------------------------------------------------------------- 1 | loadViewsFrom(__DIR__.'/Views', 'teamroles'); 29 | } 30 | 31 | /** 32 | * Define the routes for the application. 33 | * 34 | * @return void 35 | */ 36 | public function map() 37 | { 38 | $this->mapWebRoutes(); 39 | } 40 | 41 | /** 42 | * Define the "web" routes for the application. 43 | * 44 | * These routes all receive session state, CSRF protection, etc. 45 | * 46 | * @return void 47 | */ 48 | protected function mapWebRoutes() 49 | { 50 | Route::group([ 51 | 'middleware' => 'web', 52 | 'namespace' => $this->namespace, 53 | ], function ($router) { 54 | require __DIR__.'/Routes/web.php'; 55 | }); 56 | } 57 | } -------------------------------------------------------------------------------- /src/TeamRoleProvider.php: -------------------------------------------------------------------------------- 1 | [ 13 | Tehcodedninja\Teamroles\Listeners\JoinedTeamListener::class, 14 | ] 15 | ]; 16 | 17 | /** 18 | * Bootstrap the application services. 19 | * 20 | * @return void 21 | */ 22 | public function boot() 23 | { 24 | $this->publishes([__DIR__.'/Database/migrations/2016_11_13_134303_create_role_for_teams_tables.php' => 25 | base_path('database/migrations/2016_11_13_134303_create_role_for_teams_tables.php') 26 | ], 'migrations'); 27 | 28 | $this->publishes([__DIR__.'/Config/teamrole.php' => 29 | config_path() 30 | ], 'config'); 31 | 32 | $this->registerBladeExtensions(); 33 | } 34 | 35 | /** 36 | * Register the application services. 37 | * 38 | * @return void 39 | */ 40 | public function register() 41 | { 42 | } 43 | 44 | public function registerBladeExtensions() 45 | { 46 | Blade::directive('teamrole', function ($expression) { 47 | return "isTeamRole({$expression})): ?>"; 48 | }); 49 | 50 | Blade::directive('endteamrole', function () { 51 | return ""; 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Traits/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codedninja/TeamRoles/7e7c24f69fc623593e84a11827019c3a771552d2/src/Traits/.DS_Store -------------------------------------------------------------------------------- /src/Traits/UsedByUsers.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Tehcodedninja\Teamroles\Models\TeamRole', \Config::get( 'teamwork.team_user_table' ))->withPivot('team_id'); 26 | } 27 | 28 | /** 29 | * Get the user's role for a team 30 | * 31 | * @param mixed $team 32 | * @return \Tehcodedninja\Teamroles\TeamRole 33 | */ 34 | public function teamRoleFor($team) 35 | { 36 | $team_id = $this->retrieveTeamId($team); 37 | return $this->teamRoles()->wherePivot('team_id', $team_id)->first(); 38 | } 39 | 40 | /** 41 | * Get the user's role for a team 42 | * 43 | * @param mixed $team 44 | * @return boolean 45 | */ 46 | public function isOwnerOfTeam($team) 47 | { 48 | $role = $this->teamRoleFor($team); 49 | 50 | if($role->id === Config::get('teamroles.default_owner_role')) 51 | { 52 | return true; 53 | } 54 | 55 | return false; 56 | } 57 | 58 | /** 59 | * Get the user's role for the current team 60 | * 61 | * @return \Tehcodedninja\Teamroles\TeamRole 62 | */ 63 | public function getCurrentTeamRoleAttribute() 64 | { 65 | return $this->teamRoles()->wherePivot('team_id', $this->currentTeam->id)->first(); 66 | } 67 | 68 | /** 69 | * Check if user has the right role for current team 70 | * 71 | * @param string $role 72 | * @return boolean 73 | */ 74 | public function isTeamRole($role) 75 | { 76 | if ($this->currentTeamRole->name === $role) { 77 | return true; 78 | } 79 | return false; 80 | } 81 | 82 | /** 83 | * Update user's role in a team 84 | * 85 | * @param integer $team_role 86 | * @param mixed $team 87 | * @return \App\User 88 | */ 89 | public function updateTeamRole($team_role, $team = null) 90 | { 91 | // Get Team Model instance 92 | $team_id = $this->retrieveTeamId($team); 93 | 94 | // No team provider so get currentTeam 95 | if($team_id === null) 96 | { 97 | $team_id = $this->currentTeam->id; 98 | } 99 | 100 | $team_model = Config::get( 'teamwork.team_model' ); 101 | $team = ( new $team_model() )->find($team_id); 102 | 103 | // Check if in in team 104 | if(!$team->users->contains( $this->id )) 105 | { 106 | $exception = new UserNotInTeamException(); 107 | $exception->setTeam( $team->name ); 108 | throw $exception; 109 | } 110 | 111 | // Get TeamRole Model instance 112 | $team_role = TeamRole::find($team_role); 113 | 114 | // Save TeamRole to pivot 115 | $team->users()->updateExistingPivot($this->id, ['team_role_id'=>$team_role->id]); 116 | 117 | return $this; 118 | } 119 | } -------------------------------------------------------------------------------- /src/Views/admin/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Create a new team role 10 |
11 |
12 |
13 | {!! csrf_field() !!} 14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 | @if ($errors->has('name')) 22 | 23 | {{ $errors->first('name') }} 24 | 25 | @endif 26 |
27 |
28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | @if ($errors->has('label')) 36 | 37 | {{ $errors->first('label') }} 38 | 39 | @endif 40 |
41 |
42 | 43 | 44 |
45 |
46 | 49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | @endsection 58 | -------------------------------------------------------------------------------- /src/Views/admin/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Create a new team role 10 |
11 |
12 |
13 | 14 | {!! csrf_field() !!} 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @if ($errors->has('name')) 23 | 24 | {{ $errors->first('name') }} 25 | 26 | @endif 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @if ($errors->has('label')) 37 | 38 | {{ $errors->first('label') }} 39 | 40 | @endif 41 |
42 |
43 | 44 | 45 |
46 |
47 | 50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | @endsection 59 | -------------------------------------------------------------------------------- /src/Views/admin/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Team Roles 10 | 11 | Create Role 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach($roles as $role) 24 | 25 | 26 | 27 | 37 | 38 | @endforeach 39 | 40 |
NameLabelAction
{{ $role->name }}{{ $role->label }} 28 |
29 | {!! csrf_field() !!} 30 | 31 |
32 | Edit 33 | 34 |
35 |
36 |
41 |
42 |
43 |
44 |
45 | @endsection 46 | -------------------------------------------------------------------------------- /src/Views/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Create a new team
9 |
10 |
11 | {!! csrf_field() !!} 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | @if ($errors->has('name')) 20 | 21 | {{ $errors->first('name') }} 22 | 23 | @endif 24 |
25 |
26 | 27 | 28 |
29 |
30 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | @endsection 42 | -------------------------------------------------------------------------------- /src/Views/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Edit team {{$team->name}}
9 |
10 |
11 | 12 | {!! csrf_field() !!} 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @if ($errors->has('name')) 21 | 22 | {{ $errors->first('name') }} 23 | 24 | @endif 25 |
26 |
27 | 28 | 29 |
30 |
31 | 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | @endsection 43 | -------------------------------------------------------------------------------- /src/Views/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Teams 10 | 11 | Create team 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach($teams as $team) 24 | 25 | 26 | 33 | 67 | 68 | @endforeach 69 | 70 |
NameRoleActions
{{$team->name}} 27 | @if(Auth::user()->isOwnerOfTeam($team)) 28 | Owner 29 | @else 30 | {{ Auth::user()->teamRoleFor($team)->name }} 31 | @endif 32 | 34 | @if( Auth::user()->currentTeam->getKey() === $team->getKey()) 35 | Current team 36 | @endif 37 | 38 | @if(Auth::user()->isOwnerOfTeam($team)) 39 |
40 | {!! csrf_field() !!} 41 | 42 | @endif 43 |
44 | @if(is_null(auth()->user()->currentTeam) || auth()->user()->currentTeam->getKey() !== $team->getKey()) 45 | 46 | Switch 47 | 48 | @endif 49 | 50 | 51 | Members 52 | 53 | 54 | @if(Auth::user()->isOwnerOfTeam($team)) 55 | 56 | 57 | Edit 58 | 59 | 60 | 61 | @endif 62 |
63 | @if(Auth::user()->isOwnerOfTeam($team)) 64 |
65 | @endif 66 |
71 |
72 |
73 |
74 |
75 | @endsection 76 | -------------------------------------------------------------------------------- /src/Views/members/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Edit team role of {{ $user-> name }} for team {{$team->name}}
9 |
10 |
11 | 12 | {!! csrf_field() !!} 13 | 14 |
15 | 16 | 17 |
18 | 23 | {{-- --}} 24 | 25 | @if ($errors->has('role')) 26 | 27 | {{ $errors->first('role') }} 28 | 29 | @endif 30 |
31 |
32 | 33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /src/Views/members/list.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Members of team "{{$team->name}}" 10 | 11 | Back 12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach($team->users AS $user) 24 | 25 | 26 | 27 | 41 | 42 | @endforeach 43 |
NameRoleAction
{{$user->name}}{{ $user->teamRoleFor($team)->name }} 28 | @if(Auth::user()->isOwnerOfTeam($team)) 29 | @if(Auth::user()->id !== $user->id) 30 |
31 | {!! csrf_field() !!} 32 | 33 |
34 | Change Role 35 | 36 |
37 |
38 | @endif 39 | @endif 40 |
44 |
45 |
46 |
47 |
Pending invitations
48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | @foreach($team->invites AS $invite) 57 | 58 | 59 | 64 | 65 | @endforeach 66 |
E-MailAction
{{$invite->email}} 60 | 61 | Resend invite 62 | 63 |
67 |
68 |
69 | 70 | 71 |
72 |
Invite to team "{{$team->name}}"
73 |
74 |
75 | {!! csrf_field() !!} 76 |
77 | 78 | 79 |
80 | 81 | 82 | @if ($errors->has('email')) 83 | 84 | {{ $errors->first('email') }} 85 | 86 | @endif 87 |
88 |
89 | 90 | 91 |
92 |
93 | 96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | @endsection 105 | --------------------------------------------------------------------------------