This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This update is brought to you because and thanks to mmolitor87 & Vojax. Both had very valuable input on how to make SeAT-Groups even better. Thank you for being patient with me, and keep your feedback flowing. * Now respecting all users in a user_group in `isQualified()` method * You are able to setup a whole SeAT Group as manager of another SeAT Group * Refactored edit-view for managed groups * Refactored index-view for managed groups * refactored `isManager()` method * being more strict on membership * Changing Log from STRING to TEXT to accommodate longer messages. * Attempting to modify LogController to resolve an issue with too large DBs * `onFail` now correctly reports to log what went wrong ATTENTION: Managers need now to be extra careful when purging members and make sure they purge all characters from a user_group, whereas before everything was bound to the main_character. If a user lacks of at least 1 character in his user_group which qualifies in respective to your configured affiliation he will get removed from the SeAT group. This means the user will lose every role bound to this SeAT Group and needs to apply/opt-in again.
- Loading branch information
1 parent
ee9496c
commit 0a493b9
Showing
24 changed files
with
528 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: fehu | ||
* Date: 10.09.18 | ||
* Time: 15:31 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Managers; | ||
|
||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
|
||
class AddManagerAction | ||
{ | ||
public function execute (array $data) | ||
{ | ||
$seatgroup = Seatgroup::find($data['seatgroup_id']); | ||
|
||
if(isset($data['groups'])){ | ||
$groups = $data['groups']; | ||
|
||
foreach ($groups as $group) { | ||
if (in_array($group, $seatgroup->waitlist->map(function($group) { return $group->id; })->toArray())) { | ||
return redirect()->back()->with('warning', 'User must be first member before made manager'); | ||
} | ||
elseif (in_array($group, $seatgroup->member->map(function($group) { return $group->id; })->toArray())) { | ||
$seatgroup->group()->updateExistingPivot($group, [ | ||
'is_manager' => 1, | ||
]); | ||
} else { | ||
$seatgroup->group()->attach($group, [ | ||
'is_manager' => 1, | ||
]); | ||
} | ||
} | ||
} | ||
|
||
if(isset($data['seatgroups'])){ | ||
|
||
$seatgroup->children()->attach($data['seatgroups']); | ||
|
||
} | ||
|
||
|
||
return redirect()->back()->with('success', 'Updated'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: fehu | ||
* Date: 11.09.18 | ||
* Time: 15:43 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Managers; | ||
|
||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
|
||
class RemoveManagerAction | ||
{ | ||
public function execute (array $data) | ||
{ | ||
$seatgroup = Seatgroup::find($data['seatgroup_id']); | ||
$group_id = $data['group_id']; | ||
$children_id = $data['children_id']; | ||
|
||
|
||
if(isset($group_id)){ | ||
|
||
$seatgroup->group()->updateExistingPivot($group_id, [ | ||
'is_manager' => 0, | ||
]); | ||
|
||
} | ||
|
||
if(isset($children_id)){ | ||
|
||
$seatgroup->children()->detach($data['children_id']); | ||
|
||
} | ||
return redirect()->back()->with('success', 'SeAT Group removed'); | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: fehu | ||
* Date: 10.09.18 | ||
* Time: 15:18 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Http\Validation\Manager; | ||
|
||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class AddManagerRequest extends FormRequest | ||
{ | ||
/** | ||
* Authorize the request by default. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
|
||
return [ | ||
'seatgroup_id'=>'required', | ||
'groups' => 'required_if:seatgroups,""', | ||
'seatgroups' => 'required_if:groups,""', | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: fehu | ||
* Date: 11.09.18 | ||
* Time: 15:44 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Http\Validation\Manager; | ||
|
||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class RemoveManagerRequest extends FormRequest | ||
{ | ||
/** | ||
* Authorize the request by default. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
|
||
return [ | ||
'seatgroup_id'=>'required', | ||
'group_id' => 'required_if:children_id,""', | ||
'children_id' => 'required_if:group_id,""', | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.