-
Notifications
You must be signed in to change notification settings - Fork 2
#5 auth & Routes & Model
php anonymous edited this page Aug 18, 2022
·
2 revisions
These Routes are fully prepared with the inclusion of protection and the request for entry through the user, whether using api_token or JWT, sanctum
Route::get('test', [TestApiController::class , 'indexAny']);
Route::middleware('auth:api')->post('tests/restore/{id}', [TestApiController::class , 'restore']);
Route::middleware('auth:api')->delete('tests/force/delete/{id}', [TestApiController::class , 'forceDelete']);
Route::middleware('auth:api')->apiResource('tests', Api\TestApiController::class);
Do not forget to use soft delete in the Model if you use the features of restore and forced Delete
namespace App\Models; // OR namespace Modules\Test\Entities; From nwidart/laravel-modules
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Test extends Model {
use HasFactory;
use SoftDeletes;
}