akubiczek /
applicake-backend
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use App\Http\Requests\RecruitmentUserCreateRequest; |
||
| 6 | use App\Http\Resources\RecruitmentResource; |
||
| 7 | use App\Models\Recruitment; |
||
| 8 | use App\Services\TenantManager; |
||
| 9 | use Illuminate\Support\Facades\Auth; |
||
| 10 | |||
| 11 | class RecruitmentUserController extends Controller |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Create a new controller instance. |
||
| 15 | * |
||
| 16 | * @param TenantManager $tenantManager |
||
| 17 | * |
||
| 18 | * @return void |
||
| 19 | */ |
||
| 20 | public function __construct(TenantManager $tenantManager) |
||
| 21 | { |
||
| 22 | RecruitmentResource::setTenantManager($tenantManager); //workaround - not the best but it works well |
||
| 23 | } |
||
| 24 | |||
| 25 | public function list(Recruitment $recruitment) |
||
| 26 | { |
||
| 27 | return response()->json($recruitment->grantedUsers); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function create(RecruitmentUserCreateRequest $request, Recruitment $recruitment) |
||
| 31 | { |
||
| 32 | //TODO logować kto kiedy dał komu dostęp bo relacje znikają z pivota |
||
| 33 | $userId = $request->get('user_id'); |
||
|
0 ignored issues
–
show
|
|||
| 34 | $recruitment->grantedUsers()->attach($userId, ['creator_id' => Auth::user()->id]); |
||
| 35 | |||
| 36 | return response()->json($recruitment->grantedUsers); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function delete(Recruitment $recruitment, $userId) |
||
| 40 | { |
||
| 41 | $recruitment->grantedUsers()->detach($userId); |
||
| 42 | |||
| 43 | return response()->json($recruitment->grantedUsers); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.