You've already forked isop-mirror
feat: add support for deleting internships
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Internship;
|
||||
use App\Models\InternshipStatusData;
|
||||
use App\Models\User;
|
||||
@@ -310,9 +309,18 @@ class InternshipController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Internship $internship)
|
||||
public function destroy(int $id)
|
||||
{
|
||||
//
|
||||
$internship = Internship::find($id);
|
||||
|
||||
if (!$internship) {
|
||||
return response()->json([
|
||||
'message' => 'No such internship exists.'
|
||||
], 400);
|
||||
}
|
||||
$internship->delete();
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
private function validateNewInternship(Request $request)
|
||||
|
||||
@@ -46,6 +46,7 @@ Route::prefix('/internships')->group(function () {
|
||||
|
||||
Route::prefix('/{id}')->middleware("auth:sanctum")->group(function () {
|
||||
Route::get("/", [InternshipController::class, 'get'])->name("api.internships.get");
|
||||
Route::delete("/", [InternshipController::class, 'destroy'])->middleware(AdministratorOnly::class)->name("api.internships.delete");
|
||||
Route::put("/status", [InternshipStatusDataController::class, 'update'])->name("api.internships.status.update");
|
||||
Route::get("/statuses", [InternshipStatusDataController::class, 'get'])->name("api.internships.get");
|
||||
Route::get("/next-statuses", [InternshipStatusDataController::class, 'get_next_states'])->name("api.internships.status.next.get");
|
||||
|
||||
Reference in New Issue
Block a user