Total Complexity | 2 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | class AssociationsController extends Controller |
||
25 | { |
||
26 | |||
27 | public function __construct(Request $request) { |
||
28 | $subdomain = array_first(explode('.', \Request::getHost())); |
||
29 | |||
30 | $this->association = Association::where('subdomain', $subdomain)->first(); |
||
31 | } |
||
32 | |||
33 | public function index(Request $request) { |
||
34 | $user = $request->user(); |
||
35 | |||
36 | $userAssociations = Association::all()->filter(function ($association) { |
||
37 | return Bouncer::can('manage', $association); |
||
38 | }); |
||
39 | |||
40 | return new AssociationCollectionResource($userAssociations); |
||
41 | } |
||
44 |