akubiczek /
applicake-backend
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Utils\Candidates; |
||
| 4 | |||
| 5 | use App\Events\CandidateDeleted; |
||
| 6 | use App\Http\Requests\CandidateDeleteRequest; |
||
| 7 | use App\Models\Candidate; |
||
| 8 | use Illuminate\Support\Facades\Storage; |
||
| 9 | |||
| 10 | class CandidateDeleter |
||
| 11 | { |
||
| 12 | public static function deleteCandidate(CandidateDeleteRequest $request, $candidateId) |
||
| 13 | { |
||
| 14 | $candidate = Candidate::findOrFail($candidateId); |
||
| 15 | |||
| 16 | $notificationEmailAddress = null; |
||
| 17 | if ($request->get('notify_candidate')) { |
||
|
0 ignored issues
–
show
|
|||
| 18 | $notificationEmailAddress = $candidate->email; |
||
| 19 | } |
||
| 20 | |||
| 21 | Storage::delete(storage_path('app/'.$candidate->path_to_cv)); |
||
| 22 | $candidate->path_to_cv = ''; |
||
|
0 ignored issues
–
show
|
|||
| 23 | self::hashData($candidate); |
||
| 24 | $candidate->save(); |
||
| 25 | |||
| 26 | $candidate->delete(); //safe since we use softdeletes |
||
| 27 | |||
| 28 | event(new CandidateDeleted($candidate, $notificationEmailAddress)); |
||
| 29 | } |
||
| 30 | |||
| 31 | protected static function hashData(Candidate $candidate) |
||
| 32 | { |
||
| 33 | $candidate->name = sha1($candidate->first_name); |
||
|
0 ignored issues
–
show
|
|||
| 34 | $candidate->email = sha1($candidate->email); |
||
| 35 | $candidate->phone_number = sha1($candidate->phone_number); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
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.