akubiczek /
applicake-backend
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use App\Http\Requests\SourceCreateRequest; |
||
| 6 | use App\Http\Resources\SourceResource; |
||
| 7 | use App\Models\Source; |
||
| 8 | use App\Services\TenantManager; |
||
| 9 | use App\Utils\SourceCreator; |
||
| 10 | use Illuminate\Http\Request; |
||
| 11 | |||
| 12 | class SourcesController extends Controller |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Create a new controller instance. |
||
| 16 | * |
||
| 17 | * @param TenantManager $tenantManager |
||
| 18 | * |
||
| 19 | * @return void |
||
| 20 | */ |
||
| 21 | public function __construct(TenantManager $tenantManager) |
||
| 22 | { |
||
| 23 | SourceResource::setTenantManager($tenantManager); //workaround - not the best but it works well |
||
| 24 | } |
||
| 25 | |||
| 26 | public function list(Request $request) |
||
| 27 | { |
||
| 28 | $recruitmentId = $request->get('recruitment_id'); |
||
|
0 ignored issues
–
show
|
|||
| 29 | |||
| 30 | if ($recruitmentId) { |
||
| 31 | $sources = Source::where('recruitment_id', $recruitmentId)->orderBy('created_at', 'DESC')->get(); |
||
| 32 | } else { |
||
| 33 | $sources = Source::orderBy('created_at', 'DESC')->get(); |
||
| 34 | } |
||
| 35 | |||
| 36 | return SourceResource::collection($sources); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function create(SourceCreateRequest $request) |
||
| 40 | { |
||
| 41 | $source = SourceCreator::create($request->validated()); |
||
| 42 | |||
| 43 | return new SourceResource($source); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function delete($sourceId) |
||
| 47 | { |
||
| 48 | Source::find($sourceId)->delete(); |
||
| 49 | |||
| 50 | return response()->json(null, 200); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
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.