This commit is contained in:
parent
f828ca4491
commit
cb51a4136f
167 changed files with 21485 additions and 21212 deletions
|
@ -1,17 +1,17 @@
|
|||
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
||||
import type { HttpContext } from '@adonisjs/core/http';
|
||||
|
||||
export default class HomeController {
|
||||
public async index({}: HttpContextContract) {}
|
||||
public async index({}: HttpContext) {}
|
||||
|
||||
public async create({}: HttpContextContract) {}
|
||||
public async create({}: HttpContext) {}
|
||||
|
||||
public async store({}: HttpContextContract) {}
|
||||
public async store({}: HttpContext) {}
|
||||
|
||||
public async show({}: HttpContextContract) {}
|
||||
public async show({}: HttpContext) {}
|
||||
|
||||
public async edit({}: HttpContextContract) {}
|
||||
public async edit({}: HttpContext) {}
|
||||
|
||||
public async update({}: HttpContextContract) {}
|
||||
public async update({}: HttpContext) {}
|
||||
|
||||
public async destroy({}: HttpContextContract) {}
|
||||
public async destroy({}: HttpContext) {}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
||||
import Role from 'App/Models/Role';
|
||||
import Permission from 'App/Models/Permission';
|
||||
import type { ModelQueryBuilderContract } from '@ioc:Adonis/Lucid/Orm';
|
||||
import CreateRoleValidator from 'App/Validators/CreateRoleValidator';
|
||||
import UpdateRoleValidator from 'App/Validators/UpdateRoleValidator';
|
||||
import { RenderResponse } from '@ioc:EidelLev/Inertia';
|
||||
import type { HttpContext } from '@adonisjs/core/http';
|
||||
import Role from '#app/Models/Role';
|
||||
import Permission from '#app/Models/Permission';
|
||||
import CreateRoleValidator from '#app/Validators/CreateRoleValidator';
|
||||
import UpdateRoleValidator from '#app/Validators/UpdateRoleValidator';
|
||||
import type { ModelQueryBuilderContract } from "@adonisjs/lucid/types/model";
|
||||
|
||||
// import { schema, rules } from '@ioc:Adonis/Core/Validator';
|
||||
|
||||
export default class RoleController {
|
||||
public async index({ auth, request, inertia }: HttpContextContract) {
|
||||
public async index({ auth, request, inertia }: HttpContext) {
|
||||
let roles: ModelQueryBuilderContract<typeof Role, Role> = Role.query();
|
||||
|
||||
if (request.input('search')) {
|
||||
|
@ -48,14 +48,14 @@ export default class RoleController {
|
|||
});
|
||||
}
|
||||
|
||||
public async create({ inertia }: HttpContextContract) {
|
||||
public async create({ inertia }: HttpContext) {
|
||||
const permissions = await Permission.query().select('id', 'name').pluck('name', 'id');
|
||||
return inertia.render('Admin/Role/Create', {
|
||||
permissions: permissions,
|
||||
});
|
||||
}
|
||||
|
||||
public async store({ request, response, session }: HttpContextContract) {
|
||||
public async store({ request, response, session }: HttpContext) {
|
||||
// node ace make:validator CreateUser
|
||||
try {
|
||||
// Step 2 - Validate request body against the schema
|
||||
|
@ -79,7 +79,7 @@ export default class RoleController {
|
|||
return response.redirect().toRoute('role.index');
|
||||
}
|
||||
|
||||
public async show({ request, inertia }: HttpContextContract): RenderResponse {
|
||||
public async show({ request, inertia }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const role = await Role.query().where('id', id).firstOrFail();
|
||||
|
||||
|
@ -94,7 +94,7 @@ export default class RoleController {
|
|||
});
|
||||
}
|
||||
|
||||
public async edit({ request, inertia }: HttpContextContract) {
|
||||
public async edit({ request, inertia }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const role = await Role.query().where('id', id).firstOrFail();
|
||||
|
||||
|
@ -109,7 +109,7 @@ export default class RoleController {
|
|||
});
|
||||
}
|
||||
|
||||
public async update({ request, response, session }: HttpContextContract) {
|
||||
public async update({ request, response, session }: HttpContext) {
|
||||
// node ace make:validator UpdateUser
|
||||
const id = request.param('id');
|
||||
const role = await Role.query().where('id', id).firstOrFail();
|
||||
|
@ -132,7 +132,7 @@ export default class RoleController {
|
|||
return response.redirect().toRoute('settings.role.index');
|
||||
}
|
||||
|
||||
public async destroy({ request, response, session }: HttpContextContract) {
|
||||
public async destroy({ request, response, session }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const role = await Role.findOrFail(id);
|
||||
await role.delete();
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
||||
import User from 'App/Models/User';
|
||||
import Role from 'App/Models/Role';
|
||||
import type { ModelQueryBuilderContract } from '@ioc:Adonis/Lucid/Orm';
|
||||
import CreateUserValidator from 'App/Validators/CreateUserValidator';
|
||||
import UpdateUserValidator from 'App/Validators/UpdateUserValidator';
|
||||
// import { RenderResponse } from '@ioc:EidelLev/Inertia';
|
||||
import type { HttpContext } from '@adonisjs/core/http';
|
||||
import User from '#app/Models/User';
|
||||
import Role from '#app/Models/Role';
|
||||
import { ModelQueryBuilderContract } from "@adonisjs/lucid/types/model";
|
||||
import CreateUserValidator from '#app/Validators/CreateUserValidator';
|
||||
import UpdateUserValidator from '#app/Validators/UpdateUserValidator';
|
||||
// import { schema, rules } from '@ioc:Adonis/Core/Validator';
|
||||
// import Hash from '@ioc:Adonis/Core/Hash';
|
||||
// import { schema, rules } from '@ioc:Adonis/Core/Validator';
|
||||
|
||||
export default class UsersController {
|
||||
public async index({ auth, request, inertia }: HttpContextContract) {
|
||||
export default class AdminUserController {
|
||||
public async index({ auth, request, inertia }: HttpContext) {
|
||||
const page = request.input('page', 1);
|
||||
// const limit = 10
|
||||
|
||||
|
@ -48,7 +47,7 @@ export default class UsersController {
|
|||
// .preload('focusInterests')
|
||||
// .preload('role')
|
||||
.paginate(page, 5);
|
||||
|
||||
|
||||
// var test = request.all();
|
||||
|
||||
return inertia.render('Admin/User/Index', {
|
||||
|
@ -63,7 +62,7 @@ export default class UsersController {
|
|||
});
|
||||
}
|
||||
|
||||
public async create({ inertia }: HttpContextContract) {
|
||||
public async create({ inertia }: HttpContext) {
|
||||
// let rolesPluck = {};
|
||||
// (await Role.query().select('id', 'name')).forEach((user) => {
|
||||
// rolesPluck[user.id] = user.name;
|
||||
|
@ -75,7 +74,7 @@ export default class UsersController {
|
|||
});
|
||||
}
|
||||
|
||||
public async store({ request, response, session }: HttpContextContract) {
|
||||
public async store({ request, response, session }: HttpContext) {
|
||||
// node ace make:validator CreateUser
|
||||
try {
|
||||
// Step 2 - Validate request body against the schema
|
||||
|
@ -97,7 +96,7 @@ export default class UsersController {
|
|||
return response.redirect().toRoute('user.index');
|
||||
}
|
||||
|
||||
public async show({ request, inertia }: HttpContextContract) {
|
||||
public async show({ request, inertia }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const user = await User.query().where('id', id).firstOrFail();
|
||||
|
||||
|
@ -112,7 +111,7 @@ export default class UsersController {
|
|||
});
|
||||
}
|
||||
|
||||
public async edit({ request, inertia }: HttpContextContract) {
|
||||
public async edit({ request, inertia }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const user = await User.query().where('id', id).firstOrFail();
|
||||
|
||||
|
@ -127,7 +126,7 @@ export default class UsersController {
|
|||
});
|
||||
}
|
||||
|
||||
public async update({ request, response, session }: HttpContextContract) {
|
||||
public async update({ request, response, session }: HttpContext) {
|
||||
// node ace make:validator UpdateUser
|
||||
const id = request.param('id');
|
||||
const user = await User.query().where('id', id).firstOrFail();
|
||||
|
@ -154,7 +153,7 @@ export default class UsersController {
|
|||
return response.redirect().toRoute('settings.user.index');
|
||||
}
|
||||
|
||||
public async destroy({ request, response, session }: HttpContextContract) {
|
||||
public async destroy({ request, response, session }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const user = await User.findOrFail(id);
|
||||
await user.delete();
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue