add level to users table #11
@@ -16,18 +16,23 @@ class DocumentationController extends Controller
|
||||
public function index(Request $request): array
|
||||
{
|
||||
return DataTableFacade::run(
|
||||
User::query()->with('documents'),
|
||||
User::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: [
|
||||
'users.id', 'users.first_name', 'users.last_name', 'users.national_id',
|
||||
'users.phone_number', 'users.postal_code', 'users.city_id', 'users.province_id',
|
||||
'users.province_name', 'users.city_name', 'users.address', 'documents.title', 'documents.url'
|
||||
'id', 'first_name', 'last_name', 'national_id',
|
||||
'phone_number', 'postal_code', 'city_id', 'province_id',
|
||||
'province_name', 'city_name', 'address'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function files(User $user): JsonResponse
|
||||
{
|
||||
return $this->successResponse($user->load('documents'));
|
||||
}
|
||||
|
||||
public function confirm(User $user): JsonResponse
|
||||
{
|
||||
$user->update([
|
||||
|
||||
@@ -29,6 +29,7 @@ return new class extends Migration
|
||||
$table->string('province_name')->nullable();
|
||||
$table->foreignId('city_id')->nullable()->constrained('cities');
|
||||
$table->string('city_name')->nullable();
|
||||
$table->tinyInteger('authority_level')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ return new class extends Migration
|
||||
$table->string('province_name')->nullable();
|
||||
$table->foreignId('city_id')->nullable()->constrained('cities');
|
||||
$table->string('city_name')->nullable();
|
||||
$table->tinyInteger('level')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ use App\Admin\Controllers\DocumentationController;
|
||||
|
||||
Route::prefix('documents')
|
||||
->name('documents.')
|
||||
->middleware('auth')
|
||||
->controller(DocumentationController::class)
|
||||
->group(function () {
|
||||
Route::post('/', 'index')->name('index');
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('confirm', 'confirm')->name('confirm');
|
||||
Route::post('reject', 'reject')->name('reject');
|
||||
Route::get('files/{user}', 'files')->name('files');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user