Delete unused file and folder

This commit is contained in:
Daeng Deni Mardaeni 2023-05-16 16:56:59 +07:00
parent e736b5b6cc
commit 26e32d4d54
65 changed files with 191 additions and 4156 deletions

View File

@ -1,102 +0,0 @@
<?php
namespace App\DataTables\Users;
use App\Models\PermissionGroup;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class PermissionsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('name', 'like', "%" . $search['value'] . "%");
}
})
->rawColumns(['action','role'])
->addIndexColumn()
->addColumn('name', function (PermissionGroup $model) {
return $model->name;
})
->addColumn('role', function (PermissionGroup $model){
$role = $model->roles($model);
return view('pages.users.permissions._checkbox', compact('role'));
})
->addColumn('action', function (PermissionGroup $model) {
return view('pages.users.permissions._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\PermissionGroup $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(PermissionGroup $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-permissions-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name')->title('Name'),
Column::make('role')->title('Assign To'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export
* @return string
*/
protected function filename() : string
{
return 'Permissions_' . date('YmdHis');
}
}

View File

@ -1,96 +0,0 @@
<?php
namespace App\DataTables\Users;
use Spatie\Permission\Models\Role;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class RolesDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->rawColumns(['action'])
->addIndexColumn()
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('name', 'like', "%" . $search['value'] . "%");
}
})
->addColumn('action', function (Role $model) {
return view('pages.users.roles._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\Role $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Role $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-roles-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'Roles_' . date('YmdHis');
}
}

View File

@ -1,97 +0,0 @@
<?php
namespace App\DataTables\Users;
use App\Models\User;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->filter(function ($query) {
$search = request()->get('search');
if ($search['value']!=="") {
$query->where('name', 'like', "%" . $search['value'] . "%")
->orWhere('email', 'like', "%" . $search['value'] . "%");
}
})
->rawColumns(['action'])
->addIndexColumn()
->addColumn('action', function (User $model) {
return view('pages.users.users._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\User $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(User $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-users-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name')->title(__('Name')),
Column::make('email'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'Users_' . date('YmdHis');
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\ApiController;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
class AuthApiController extends ApiController
{
/**
* Register api
*
* @return \Illuminate\Http\Response
*/
public function register(Request $request)
: JsonResponse
{
$validator = Validator::make($request->all(), [
'name' => 'required',
'email' => 'required|email',
'password' => 'required',
'password_confirmation' => 'required|same:password',
]);
if ($validator->fails()) {
return $this->sendError('Validation Error.', $validator->errors());
}
$input = $request->all();
$input['password'] = bcrypt($input['password']);
$user = User::create($input);
$success['token'] = $user->createToken('MyApp')->plainTextToken;
$success['name'] = $user->name;
return $this->sendResponse($success, 'User register successfully.');
}
/**
* Login api
*
* @return \Illuminate\Http\Response
*/
public function login(Request $request)
: JsonResponse
{
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
$user = Auth::user();
$success['token'] = $user->createToken('MyApp')->plainTextToken;
$success['name'] = $user->name;
return $this->sendResponse($success, 'User login successfully.');
} else {
return $this->sendError('Unauthorised.', ['error' => 'Unauthorised']);
}
}
}

View File

@ -1,58 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*
* @return \Illuminate\View\View
*/
public function create()
{
addJavascriptFile('assets/js/custom/authentication/sign-in/general.js');
return view('pages.auth.login');
}
/**
* Handle an incoming authentication request.
*
* @param \App\Http\Requests\Auth\LoginRequest $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(LoginRequest $request)
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(RouteServiceProvider::HOME);
}
/**
* Destroy an authenticated session.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*
* @return \Illuminate\View\View
*/
public function show()
{
return view('pages.auth.confirm-password');
}
/**
* Confirm the user's password.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function store(Request $request)
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(RouteServiceProvider::HOME);
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME);
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function __invoke(Request $request)
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(RouteServiceProvider::HOME)
: view('pages.auth.verify-email');
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function create(Request $request)
{
return view('pages.auth.reset-password', ['request' => $request]);
}
/**
* Handle an incoming new password request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'token' => ['required'],
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*
* @return \Illuminate\View\View
*/
public function create()
{
addJavascriptFile('assets/js/custom/authentication/reset-password/reset-password.js');
return view('pages.auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'email' => ['required', 'email'],
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -1,56 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*
* @return \Illuminate\View\View
*/
public function create()
{
addJavascriptFile('assets/js/custom/authentication/sign-up/general.js');
return view('pages.auth.register');
}
/**
* Handle an incoming registration request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(RouteServiceProvider::HOME);
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(EmailVerificationRequest $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
}
}

View File

@ -1,205 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\PermissionsDataTable;
use App\Http\Controllers\Controller;
use App\Models\PermissionGroup;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\Permission;
class PermissionsController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(PermissionsDataTable $dataTable)
{
/* if (is_null($this->user) || !$this->user->can('permission.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any permission !');
}*/
return $dataTable->render('pages.users.permissions.index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
/*if (is_null($this->user) || !$this->user->can('permission.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any permission !');
}*/
// Validation Data
$validate = $request->validate([
'name' => 'required|max:100|unique:permission_groups'
], [
'name.requried' => 'Please give a permission name'
]);
if($validate){
try{
// Process Data
$group = PermissionGroup::create(['name' => $request->name]);
$group_name = strtolower($request->name);
$data = [
$group_name.'.create',
$group_name.'.read',
$group_name.'.update',
$group_name.'.delete',
$group_name.'.authorize',
$group_name.'.report'
];
foreach($data as $permission){
Permission::create([
'name' => $permission,
'guard_name' => 'web',
'permission_group_id' => $group->id
]);
}
echo json_encode(['status' => 'success', 'message' => 'Permission created successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Permission created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
/*if (is_null($this->user) || !$this->user->can('permission.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any permission !');
}*/
$permission = PermissionGroup::find($id);
echo json_encode($permission);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('permission.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any permission !');
}*/
// Validation Data
$validated = $request->validate([
'name' => 'required|max:100|unique:permission_groups,name,' . $id
], [
'name.requried' => 'Please give a permission name'
]);
if ($validated) {
try {
// Process Data
$group = PermissionGroup::find($id);
$group->name = $request->name;
if($group->save()){
$group_name = strtolower($request->name);
$permissions = Permission::where('permission_group_id', $group->id)->get();
$data = [
$group_name . '.create',
$group_name . '.read',
$group_name . '.update',
$group_name . '.delete',
$group_name . '.authorize',
$group_name . '.report'
];
$i = 0;
foreach($permissions as $permission){
$permission->name = $data[$i];
$permission->save();
$i++;
}
}
echo json_encode(['status' => 'success', 'message' => 'Permission updated successfully.']);
} catch (\Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Permission updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
/*if (is_null($this->user) || !$this->user->can('permission.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any role !');
}*/
$permission = PermissionGroup::find($id);
if (!is_null($permission)) {
if($permission->delete()){
Permission::where('permission_group_id',$id)->delete();
}
}
echo json_encode(['status' => 'success', 'message' => 'Permission deleted successfully.']);
}
}

View File

@ -1,190 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\RolesDataTable;
use App\Http\Controllers\Controller;
use App\Models\PermissionGroup;
use App\Models\User;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Role;
use App\Models\Permission;
class RolesController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(RolesDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('role.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any role !');
}*/
$permissiongroups = PermissionGroup::all();
return $dataTable->render('pages.users.roles.index', compact('permissiongroups'));
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function store(Request $request)
{
/*if (is_null($this->user) || !$this->user->can('role.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any role !');
}*/
// Validation Data
$validated = $request->validate([
'name' => 'required|max:100|unique:roles'
], [
'name.requried' => 'Please give a role name'
]);
if ($validated) {
try {
// Process Data
$role = Role::create(['name' => $request->name, 'guard_name' => 'web']);
$permissions = $request->input('permissions');
if (!empty($permissions)) {
$role = Role::find($role->id);
$role->syncPermissions($permissions);
}
echo json_encode(['status' => 'success', 'message' => 'Role Created Successfully']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Role Created Failed']);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
/* if (is_null($this->user) || !$this->user->can('role.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
}*/
$role = Role::findById($id, 'web');
$permissions = Permission::all();
$permissiongroups = PermissionGroup::all();
$_array = [
'role' => $role,
'permissions' => $permissions,
'permissiongroups' => $permissiongroups
];
return view('pages.users.roles.edit', $_array);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
*
* @return Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('role.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
}*/
// Validation Data
$request->validate([
'name' => 'required|max:100|unique:roles,name,' . $id
], [
'name.requried' => 'Please give a role name'
]);
$role = Role::findById($id, 'web');
$permissions = $request->input('permissions');
$role->name = $request->name;
$role->save();
if (!empty($permissions)) {
$role->syncPermissions($permissions);
}
session()->flash('success', 'Role has been updated !!');
return redirect()->route('user.roles.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id)
{
/*if (is_null($this->user) || !$this->user->can('role.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any role !');
}*/
$role = Role::findById($id, 'web');
if (!is_null($role)) {
$role->delete();
}
session()->flash('success', 'Role has been deleted !!');
return redirect()->route('user.roles.index');
}
}

View File

@ -1,237 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\UsersDataTable;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Models\UserInfo;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Modules\CetakLabel\Entities\Directorat;
use Spatie\Permission\Models\Role;
class UsersController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(UsersDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('user.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any users !');
}*/
addVendor('chained-select');
$directorat = Directorat::all();
$roles = Role::all();
return $dataTable->render('pages.users.users.index', compact('directorat', 'roles'));
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
/* if (is_null($this->user) || !$this->user->can('user.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any users !');
}*/
$roles = Role::all();
return view('pages.users.create', compact('roles'));
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function store(Request $request)
{
/* if (is_null($this->user) || !$this->user->can('user.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any users !');
}*/
// Validation Data
$request->password = 'bagbag';
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users'
]);
if ($validated) {
try {
// Create New User
$user = new User();
$user->name = $request->name;
$user->email = $request->email;
$user->directorat_id = $request->directorat_id;
$user->sub_directorat_id = $request->sub_directorat_id;
$user->password = Hash::make($request->password);
$user->save();
if ($request->roles) {
$user->assignRole($request->roles);
}
echo json_encode([
'status' => 'success',
'message' => 'User Created Successfully'
]);
} catch (Exception $e) {
echo json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
/*if (is_null($this->user) || !$this->user->can('user.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any users !');
}*/
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
/*if (is_null($this->user) || !$this->user->can('user.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any users !');
}*/
$user = User::find($id);
$roles = $user->roles;
echo json_encode([
'status' => 'success',
'data' => $user,
'roles' => $roles
]);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
*
* @return Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('user.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any users !');
}*/
// Create New User
$user = User::find($id);
// Validation Data
if ($request->password !== '') {
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users,email,' . $id,
'password' => 'nullable|min:6|confirmed'
]);
} else {
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users,email,' . $id
]);
}
if ($validated) {
try {
$user->name = $request->name;
$user->email = $request->email;
$user->directorat_id = $request->directorat_id;
$user->sub_directorat_id = $request->sub_directorat_id;
if ($request->password) {
$user->password = Hash::make($request->password);
}
$user->save();
$user->roles()->detach();
if ($request->roles) {
$user->assignRole($request->roles);
}
echo json_encode([
'status' => 'success',
'message' => 'User Updated Successfully'
]);
} catch (Exception $e) {
echo json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy(User $user)
{
/*if (is_null($this->user) || !$this->user->can('user.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any users !');
}*/
$user->delete();
echo json_encode([
'status' => 'success',
'message' => 'User Deleted Successfully'
]);
}
}

View File

@ -1,93 +0,0 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string'],
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited()
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*
* @return string
*/
public function throttleKey()
{
return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip());
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Permission as SpatiePermission;
class Permission extends SpatiePermission
{
use LogsActivity;
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function group()
{
return $this->hasOne(PermissionGroup::class);
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Role;
class PermissionGroup extends Model
{
use LogsActivity;
protected $fillable = [
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function permission(){
return $this->hasMany(Permission::class);
}
public function roles($group){
$permission = Permission::where('permission_group_id', $group->id)->first();
$data = [];
$roles = Role::all();
foreach($roles as $role){
if($role->hasPermissionTo($permission->name)){
array_push($data,$role);
}
}
return $data;
}
public static function getpermissionsByGroupId($id)
{
$permissions = DB::table('permissions')
->select('name', 'id')
->where('permission_group_id', $id)
->get();
return $permissions;
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Wildside\Userstamps\Userstamps;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, Userstamps;
use HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
'directorat_id',
'sub_directorat_id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

View File

@ -1,28 +1,27 @@
<?php
namespace App\Providers;
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
class AuthServiceProvider extends ServiceProvider
{
//
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
//
}
}
}

View File

@ -2,7 +2,10 @@
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^8.0.2",
@ -18,6 +21,8 @@
"laravel/tinker": "^2.7",
"laravelcollective/html": "^6.4",
"nwidart/laravel-modules": "^10.0",
"putrakuningan/cetaklabel-module": "dev-master",
"putrakuningan/logs-module": "^1.0",
"spatie/laravel-activitylog": "^4.7",
"spatie/laravel-permission": "^5.10",
"wildside/userstamps": "^2.3",
@ -80,8 +85,19 @@
"prefer-stable": true,
"repositories": [
{
"name": "putrakuningan/logs-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/cetaklabel-module"
"url": "https://git.putrakuningan.com/putrakuningan/Logs"
},
{
"name": "putrakuningan/cetaklabel-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/CetakLabel"
},
{
"name": "putrakuningan/usermanager-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/UserManager"
}
]
}

75
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6e4b7a5d95ae071c96a379148defd16e",
"content-hash": "3331fe53e7be9dc11ac871275b11223c",
"packages": [
{
"name": "anlutro/l4-settings",
@ -691,16 +691,16 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "7.6.0",
"version": "7.6.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "733dd89533dd371a0987172727df15f500dab0ef"
"reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/733dd89533dd371a0987172727df15f500dab0ef",
"reference": "733dd89533dd371a0987172727df15f500dab0ef",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/8444a2bacf1960bc6a2b62ed86b8e72e11eebe51",
"reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51",
"shasum": ""
},
"require": {
@ -796,7 +796,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.6.0"
"source": "https://github.com/guzzle/guzzle/tree/7.6.1"
},
"funding": [
{
@ -812,7 +812,7 @@
"type": "tidelift"
}
],
"time": "2023-05-14T11:23:39+00:00"
"time": "2023-05-15T20:43:01+00:00"
},
{
"name": "guzzlehttp/promises",
@ -4026,6 +4026,63 @@
},
"time": "2023-05-05T20:02:42+00:00"
},
{
"name": "putrakuningan/cetaklabel-module",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://git.putrakuningan.com/putrakuningan/CetakLabel",
"reference": "5db56258b31950f162a4ab1b5769932e3d258818"
},
"default-branch": true,
"type": "laravel-module",
"extra": {
"laravel": {
"providers": [],
"aliases": []
}
},
"autoload": {
"psr-4": {
"Modules\\CetakLabel\\": ""
}
},
"authors": [
{
"name": "Daeng Deni Mardaeni",
"email": "ddeni05@gmail.com"
}
],
"time": "2023-05-15T17:14:11+00:00"
},
{
"name": "putrakuningan/logs-module",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://git.putrakuningan.com/putrakuningan/Logs",
"reference": "c3fcefb6b1cf3aeabe249391a70e58a3a5a38419"
},
"type": "laravel-module",
"extra": {
"laravel": {
"providers": [],
"aliases": []
}
},
"autoload": {
"psr-4": {
"Modules\\CetakLabel\\": ""
}
},
"authors": [
{
"name": "Daeng Deni Mardaeni",
"email": "ddeni05@gmail.com"
}
],
"time": "2023-05-15T17:16:12+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
@ -10089,7 +10146,9 @@
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"stability-flags": {
"putrakuningan/cetaklabel-module": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {

View File

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Facades\Facade;
return [
return [
/*
|--------------------------------------------------------------------------
@ -156,49 +156,49 @@ return [
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\HelperServiceProvider::class,
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\HelperServiceProvider::class,
App\Providers\AppServiceProvider::class,
\App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Yajra\DataTables\DataTablesServiceProvider::class,
Jackiedo\LogReader\LogReaderServiceProvider::class,
Yajra\DataTables\DataTablesServiceProvider::class,
Jackiedo\LogReader\LogReaderServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,
],

View File

@ -61,8 +61,8 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
'driver' => 'eloquent',
'model' => \Modules\UserManager\Entities\User::class,
],
// 'users' => [

View File

@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Modules\UserManager\Entities\User>
*/
class UserFactory extends Factory
{

View File

@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->foreignIdFor('Modules\CetakLabel\Entities\Directorat', 'directorat_id')->nullable();
$table->foreignIdFor('Modules\CetakLabel\Entities\SubDirectorat', 'sub_directorat_id')->nullable();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
};

View File

@ -1,37 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View File

@ -1,41 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -1,141 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\PermissionRegistrar;
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
$teams = config('permission.teams');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->bigIncrements('id'); // permission id
$table->string('name'); // For MySQL 8.0 use string('name', 125);
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
$table->timestamps();
$table->unique(['name', 'guard_name']);
});
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
$table->bigIncrements('id'); // role id
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name'); // For MySQL 8.0 use string('name', 125);
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign(PermissionRegistrar::$pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
} else {
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
}
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign(PermissionRegistrar::$pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
} else {
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
}
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
$table->foreign(PermissionRegistrar::$pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign(PermissionRegistrar::$pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableNames = config('permission.table_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
}
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}

View File

@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permission_groups', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permission_groups');
}
};

View File

@ -1,28 +0,0 @@
<?php
use App\Models\PermissionGroup;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('permissions', function($table) {
$table->foreignIdFor(PermissionGroup::class);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropForeignKey('permission_group_id');
Schema::dropColumn('permission_group_id');
}
};

View File

@ -3,9 +3,10 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Database\Seeder;
use Modules\UserManager\Database\Seeders\UsersSeeder;
class DatabaseSeeder extends Seeder
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
@ -14,15 +15,6 @@
*/
public function run()
{
$this->call([
UsersSeeder::class
]);
// \App\Models\User::factory(10)->create();
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
}
}

View File

@ -1,33 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Faker\Generator;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class UsersSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run(Generator $faker)
{
$demoUser = User::create([
'name' => $faker->name,
'email' => 'demo@demo.com',
'password' => Hash::make('demo'),
'email_verified_at' => now(),
]);
$demoUser2 = User::create([
'name' => $faker->name,
'email' => 'admin@demo.com',
'password' => Hash::make('demo'),
'email_verified_at' => now(),
]);
}
}

View File

@ -1,3 +1,5 @@
{
"CetakLabel": true
"CetakLabel": true,
"Logs": true,
"UserManager": true
}

View File

@ -1,41 +0,0 @@
<x-auth-layout>
<!--begin::Form-->
<form class="form w-100" novalidate="novalidate" id="kt_password_reset_form" data-kt-redirect-url="/reset-password" action="#">
@csrf
<!--begin::Heading-->
<div class="text-center mb-10">
<!--begin::Title-->
<h1 class="text-dark fw-bolder mb-3">
Forgot Password ?
</h1>
<!--end::Title-->
<!--begin::Link-->
<div class="text-gray-500 fw-semibold fs-6">
Enter your email to reset your password.
</div>
<!--end::Link-->
</div>
<!--begin::Heading-->
<!--begin::Input group--->
<div class="fv-row mb-8">
<!--begin::Email-->
<input type="text" placeholder="Email" name="email" autocomplete="off" class="form-control bg-transparent"/>
<!--end::Email-->
</div>
<!--begin::Actions-->
<div class="d-flex flex-wrap justify-content-center pb-lg-0">
<button type="button" id="kt_password_reset_submit" class="btn btn-primary me-4">
@include('partials/general/_button-indicator', ['label' => 'Submit'])
</button>
<a href="/login" class="btn btn-light">Cancel</a>
</div>
<!--end::Actions-->
</form>
<!--end::Form-->
</x-auth-layout>

View File

@ -1,102 +0,0 @@
<x-auth-layout>
<!--begin::Form-->
<form class="form w-100" novalidate="novalidate" id="kt_sign_in_form" data-kt-redirect-url="/" action="login">
@csrf
<!--begin::Heading-->
<div class="text-center mb-11">
<!--begin::Title-->
<h1 class="text-dark fw-bolder mb-3">
Sign In
</h1>
<!--end::Title-->
<!--begin::Subtitle-->
<div class="text-gray-500 fw-semibold fs-6">
Your Social Campaigns
</div>
<!--end::Subtitle--->
</div>
<!--begin::Heading-->
<!--begin::Login options-->
<div class="row g-3 mb-9">
<!--begin::Col-->
<div class="col-md-6">
<!--begin::Google link--->
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<img alt="Logo" src="{{ image('svg/brand-logos/google-icon.svg') }}" class="h-15px me-3"/>
Sign in with Google
</a>
<!--end::Google link--->
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-md-6">
<!--begin::Google link--->
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<img alt="Logo" src="{{ image('svg/brand-logos/apple-black.svg') }}" class="theme-light-show h-15px me-3"/>
<img alt="Logo" src="{{ image('svg/brand-logos/apple-black-dark.svg') }}" class="theme-dark-show h-15px me-3"/>
Sign in with Apple
</a>
<!--end::Google link--->
</div>
<!--end::Col-->
</div>
<!--end::Login options-->
<!--begin::Separator-->
<div class="separator separator-content my-14">
<span class="w-125px text-gray-500 fw-semibold fs-7">Or with email</span>
</div>
<!--end::Separator-->
<!--begin::Input group--->
<div class="fv-row mb-8">
<!--begin::Email-->
<input type="text" placeholder="Email" name="email" autocomplete="off" class="form-control bg-transparent" value="demo@demo.com"/>
<!--end::Email-->
</div>
<!--end::Input group--->
<div class="fv-row mb-3">
<!--begin::Password-->
<input type="password" placeholder="Password" name="password" autocomplete="off" class="form-control bg-transparent" value="demo"/>
<!--end::Password-->
</div>
<!--end::Input group--->
<!--begin::Wrapper-->
<div class="d-flex flex-stack flex-wrap gap-3 fs-base fw-semibold mb-8">
<div></div>
<!--begin::Link-->
<a href="/forgot-password" class="link-primary">
Forgot Password ?
</a>
<!--end::Link-->
</div>
<!--end::Wrapper-->
<!--begin::Submit button-->
<div class="d-grid mb-10">
<button type="submit" id="kt_sign_in_submit" class="btn btn-primary">
@include('partials/general/_button-indicator', ['label' => 'Sign In'])
</button>
</div>
<!--end::Submit button-->
<!--begin::Sign up-->
<div class="text-gray-500 text-center fw-semibold fs-6">
Not a Member yet?
<a href="/register" class="link-primary">
Sign up
</a>
</div>
<!--end::Sign up-->
</form>
<!--end::Form-->
</x-auth-layout>

View File

@ -1,142 +0,0 @@
<x-auth-layout>
<!--begin::Form-->
<form class="form w-100" novalidate="novalidate" id="kt_sign_up_form" data-kt-redirect-url="/login" action="register">
@csrf
<!--begin::Heading-->
<div class="text-center mb-11">
<!--begin::Title-->
<h1 class="text-dark fw-bolder mb-3">
Sign Up
</h1>
<!--end::Title-->
<!--begin::Subtitle-->
<div class="text-gray-500 fw-semibold fs-6">
Your Social Campaigns
</div>
<!--end::Subtitle--->
</div>
<!--begin::Heading-->
<!--begin::Login options-->
<div class="row g-3 mb-9">
<!--begin::Col-->
<div class="col-md-6">
<!--begin::Google link--->
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<img alt="Logo" src="{{ image('svg/brand-logos/google-icon.svg') }}" class="h-15px me-3"/>
Sign in with Google
</a>
<!--end::Google link--->
</div>
<!--end::Col-->
<!--begin::Col-->
<div class="col-md-6">
<!--begin::Google link--->
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<img alt="Logo" src="{{ image('svg/brand-logos/apple-black.svg') }}" class="theme-light-show h-15px me-3"/>
<img alt="Logo" src="{{ image('svg/brand-logos/apple-black-dark.svg') }}" class="theme-dark-show h-15px me-3"/>
Sign in with Apple
</a>
<!--end::Google link--->
</div>
<!--end::Col-->
</div>
<!--end::Login options-->
<!--begin::Separator-->
<div class="separator separator-content my-14">
<span class="w-125px text-gray-500 fw-semibold fs-7">Or with email</span>
</div>
<!--end::Separator-->
<!--begin::Input group--->
<div class="fv-row mb-8">
<!--begin::Name-->
<input type="text" placeholder="Name" name="name" autocomplete="off" class="form-control bg-transparent"/>
<!--end::Name-->
</div>
<!--begin::Input group--->
<div class="fv-row mb-8">
<!--begin::Email-->
<input type="text" placeholder="Email" name="email" autocomplete="off" class="form-control bg-transparent"/>
<!--end::Email-->
</div>
<!--begin::Input group-->
<div class="fv-row mb-8" data-kt-password-meter="true">
<!--begin::Wrapper-->
<div class="mb-1">
<!--begin::Input wrapper-->
<div class="position-relative mb-3">
<input class="form-control bg-transparent" type="password" placeholder="Password" name="password" autocomplete="off"/>
<span class="btn btn-sm btn-icon position-absolute translate-middle top-50 end-0 me-n2" data-kt-password-meter-control="visibility">
<i class="bi bi-eye-slash fs-2"></i>
<i class="bi bi-eye fs-2 d-none"></i>
</span>
</div>
<!--end::Input wrapper-->
<!--begin::Meter-->
<div class="d-flex align-items-center mb-3" data-kt-password-meter-control="highlight">
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px me-2"></div>
<div class="flex-grow-1 bg-secondary bg-active-success rounded h-5px"></div>
</div>
<!--end::Meter-->
</div>
<!--end::Wrapper-->
<!--begin::Hint-->
<div class="text-muted">
Use 8 or more characters with a mix of letters, numbers & symbols.
</div>
<!--end::Hint-->
</div>
<!--end::Input group--->
<!--end::Input group--->
<div class="fv-row mb-8">
<!--begin::Repeat Password-->
<input placeholder="Repeat Password" name="password_confirmation" type="password" autocomplete="off" class="form-control bg-transparent"/>
<!--end::Repeat Password-->
</div>
<!--end::Input group--->
<!--begin::Accept-->
<div class="fv-row mb-8">
<label class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" name="toc" value="1"/>
<span class="form-check-label fw-semibold text-gray-700 fs-base ms-1">
I Accept the <a href="#" class="ms-1 link-primary">Terms</a>
</span>
</label>
</div>
<!--end::Accept-->
<!--begin::Submit button-->
<div class="d-grid mb-10">
<button type="submit" id="kt_sign_up_submit" class="btn btn-primary">
@include('partials/general/_button-indicator', ['label' => 'Sign Up'])
</button>
</div>
<!--end::Submit button-->
<!--begin::Sign up-->
<div class="text-gray-500 text-center fw-semibold fs-6">
Already have an Account?
<a href="/login" class="link-primary fw-semibold">
Sign in
</a>
</div>
<!--end::Sign up-->
</form>
<!--end::Form-->
</x-auth-layout>

View File

@ -1,51 +0,0 @@
<x-auth-layout>
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</x-slot>
<form method="POST" action="{{ route('password.update') }}">
@csrf
<!-- Password Reset Token -->
<input type="hidden" name="token" value="{{ $request->input('token') }}">
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Reset Password') }}
</x-primary-button>
</div>
</form>
</x-auth-card>
</x-auth-layout>

View File

@ -1,13 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
<a href="{{ route($route[0].'.edit',['directorat' => $model->id]) }}"
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
</a>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!}
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
{!! Form::close() !!}
</div>

View File

@ -1,70 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<div class="modal fade" id="kt_modal_directorat" tabindex="-1" aria-hidden="true">
<!--begin::Modal dialog-->
<div class="modal-dialog modal-dialog-centered mw-650px">
<!--begin::Modal content-->
<div class="modal-content rounded">
<!--begin::Modal header-->
<div class="modal-header pb-0 border-0 justify-content-end">
<!--begin::Close-->
<div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal">{!! getIcon('cross', 'fs-1') !!}</div>
<!--end::Close-->
</div>
<!--begin::Modal header-->
<!--begin::Modal body-->
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
<!--begin:Form-->
<form class="form_{{$route[0]}}" method="POST" action="{{ route($route[0].'.store') }}">
@csrf
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Kode</span>
<span class="ms-1" data-bs-toggle="tooltip" title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="hidden" id="directorat_id" name="id" />
<input type="text" id="directorat_kode" minlength="2" maxlength="2" pattern="[0-9]{2,2}" class="form-control form-control-solid" placeholder="Enter Kode Directorat" name="kode" />
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Name</span>
<span class="ms-1" data-bs-toggle="tooltip" title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="text" id="directorat_name" maxlength="50" class="form-control form-control-solid" placeholder="Enter Directorat Name" name="name" />
</div>
<!--end::Input group-->
<!--begin::Actions-->
<div class="text-center">
<button type="reset" data-bs-dismiss="modal" class="btn btn-light me-3">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
<!--end::Actions-->
</form>
<!--end:Form-->
</div>
<!--end::Modal body-->
</div>
<!--end::Modal content-->
</div>
<!--end::Modal dialog-->
</div>
<!--end::Modal - New Target-->

View File

@ -1,116 +0,0 @@
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
{{-- Inject Scripts --}}
@section('scripts')
{{ $dataTable->scripts() }}
@endsection
@push('customscript')
@php
$route = explode('.', Route::currentRouteName());
@endphp
<script>
$("#searchbox").on("keyup search input paste cut", function () {
LaravelDataTables["{{$route[0]}}-table"].search(this.value).draw();
});
$(function () {
const documentTitle = '{{ ucfirst($route[0]) }} Report';
var buttons = new $.fn.dataTable.Buttons(LaravelDataTables["{{$route[0]}}-table"], {
buttons: [
{
extend: 'copyHtml5',
title: documentTitle
},
{
extend: 'excelHtml5',
title: documentTitle
},
{
extend: 'csvHtml5',
title: documentTitle
},
{
extend: 'pdfHtml5',
title: documentTitle
},
{
extend: 'print',
title: documentTitle
}
]
}).container().appendTo($('#kt_datatable_example_buttons'));
// Hook dropdown menu click event to datatable export buttons
const exportButtons = document.querySelectorAll('#kt_datatable_example_export_menu [data-kt-export]');
exportButtons.forEach(exportButton => {
exportButton.addEventListener('click', e => {
e.preventDefault();
console.log(e.target.getAttribute('data-kt-export'));
// Get clicked export value
const exportValue = e.target.getAttribute('data-kt-export');
const target = document.querySelector('.dt-buttons .buttons-' + exportValue);
// Trigger click event on hidden datatable export buttons
target.click();
});
});
LaravelDataTables["{{$route[0]}}-table"].on('click','.kt_edit_form',function(event){
event.preventDefault();
$.ajax({
url: $(this).attr('href'),
type: 'GET',
dataType: 'json',
success: function (response) {
$('#title_form').text('Edit {{ ucfirst(str_replace('-',' ',$route[0])) }}');
$('#{{$route[0]}}_id').val(response.id);
$('#{{$route[0]}}_name').val(response.name);
$('#{{$route[0]}}_kode').val(response.kode);
$('.form_{{$route[0]}}').attr('action', '{{ URL::to('/'.$route[0].'/') }}/' + response.id).append('<input type="hidden" name="_method" value="PUT">');
$('#kt_modal_{{$route[0]}}').modal('show');
}
})
})
LaravelDataTables["{{$route[0]}}-table"].on('click', '.delete', function (event) {
var form = $(this).closest("form");
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});
}
})
})
})
</script>
@endpush
@section('styles')
<style>
.dataTables_filter {
display: none;
}
</style>
@endsection

View File

@ -1,131 +0,0 @@
<x-default-layout>
<!--begin::Card-->
<div class="card card-xxl-stretch mb-5 mb-xl-8">
<!--begin::Card body-->
<div class="card-header border-0 pt-5">
<div class="card-title align-items-start flex-column">
<div class="d-flex align-items-center position-relative my-1">
<!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
<span class="svg-icon svg-icon-1 position-absolute ms-6">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1"
transform="rotate(45 17.0365 15.1223)" fill="currentColor"></rect>
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
</svg>
</span>
<!--end::Svg Icon-->
<input type="text" id="searchbox"
class="form-control form-control-solid border border-gray-300 w-250px ps-15"
placeholder="Search Directorat">
</div>
<!--begin::Export buttons-->
<div id="kt_datatable_example_1_export" class="d-none"></div>
<!--end::Export buttons-->
</div>
<div class="card-toolbar">
<!--begin::Export dropdown-->
<button type="button" class="btn btn-light-primary" data-kt-menu-trigger="click"
data-kt-menu-placement="bottom-end">
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
Export Report
</button>
<!--begin::Menu-->
<div id="kt_datatable_example_export_menu"
class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4"
data-kt-menu="true">
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="copy">
Copy to clipboard
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="excel">
Export as Excel
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="csv">
Export as CSV
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="pdf">
Export as PDF
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="print">
Print
</a>
</div>
<!--end::Menu item-->
</div>
<!--begin::Hide default export buttons-->
<div id="kt_datatable_example_buttons" class="d-none"></div>
<!--end::Hide default export buttons-->
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.directorat._table')
@include('pages.masters.directorat._form')
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
$(function () {
$(".form_directorat").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var actionUrl = form.attr('action');
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
form[0].reset();
LaravelDataTables["directorat-table"].ajax.reload();
$('#kt_modal_directorat').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function (key, value) {
toastr.error(value);
});
}
});
});
$('#kt_modal_directorat').on('hidden.bs.modal', function (e) {
$(".form_directorat")[0].reset();
$(".form_directorat").attr('action', "{{ route('directorat.store') }}");
$(".form_directorat").find('input[name="_method"]').remove();
$("#title_form").html("Create Directorat");
})
});
</script>
@endpush
</x-default-layout>

View File

@ -1,13 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
<a href="{{ route($route[0].'.'.$route[1].'.edit',['permission' => $model->id]) }}"
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
</a>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.'.$route[1].'.destroy', $model->id],'class'=>'']) !!}
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
{!! Form::close() !!}
</div>

View File

@ -1,21 +0,0 @@
<td>
@php
$color = [
'badge-white',
'badge-light-primary',#
'badge-light-dark',#
'badge-secondary',
'badge-light-success',#
'badge-light-info',#
'badge-light-warning',#
'badge-light-danger'#
];
$i = 1;
@endphp
@foreach($role as $row)
<a href="javascript:;" class="text-capitalize badge {{ $color[$row->id] }} fs-7 m-1">{{ $row->name }}</a>
@php $i++ @endphp
@endforeach
</td>

View File

@ -1,58 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<div class="modal fade" id="kt_modal_user_permissions" tabindex="-1" aria-hidden="true">
<!--begin::Modal dialog-->
<div class="modal-dialog modal-dialog-centered mw-650px">
<!--begin::Modal content-->
<div class="modal-content rounded">
<!--begin::Modal header-->
<div class="modal-header pb-0 border-0 justify-content-end">
<!--begin::Close-->
<div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal">{!! getIcon('cross', 'fs-1') !!}</div>
<!--end::Close-->
</div>
<!--begin::Modal header-->
<!--begin::Modal body-->
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
<!--begin:Form-->
<form class="form_{{$route[0].'_'.$route[1]}}" method="POST" action="{{ route($route[0].'.'.$route[1].'.store') }}">
@csrf
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0].' '.$route[1]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Name</span>
<span class="ms-1" data-bs-toggle="tooltip" title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="hidden" id="user_permissions_id" name="id" />
<input type="text" id="user_permissions_name" maxlength="50" class="form-control form-control-solid" placeholder="Enter Permission Name" name="name" />
</div>
<!--end::Input group-->
<!--begin::Actions-->
<div class="text-center">
<button type="reset" data-bs-dismiss="modal" class="btn btn-light me-3">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
<!--end::Actions-->
</form>
<!--end:Form-->
</div>
<!--end::Modal body-->
</div>
<!--end::Modal content-->
</div>
<!--end::Modal dialog-->
</div>
<!--end::Modal - New Target-->

View File

@ -1,116 +0,0 @@
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
{{-- Inject Scripts --}}
@section('scripts')
{{ $dataTable->scripts() }}
@endsection
@push('customscript')
@php
$route = explode('.', Route::currentRouteName());
@endphp
<script>
$("#searchbox").on("keyup search input paste cut", function () {
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].search(this.value).draw();
});
$(function () {
const documentTitle = '{{ ucfirst($route[0].' '.$route[1]) }} Report';
var buttons = new $.fn.dataTable.Buttons(LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"], {
buttons: [
{
extend: 'copyHtml5',
title: documentTitle
},
{
extend: 'excelHtml5',
title: documentTitle
},
{
extend: 'csvHtml5',
title: documentTitle
},
{
extend: 'pdfHtml5',
title: documentTitle
},
{
extend: 'print',
title: documentTitle
}
]
}).container().appendTo($('#kt_datatable_example_buttons'));
// Hook dropdown menu click event to datatable export buttons
const exportButtons = document.querySelectorAll('#kt_datatable_example_export_menu [data-kt-export]');
exportButtons.forEach(exportButton => {
exportButton.addEventListener('click', e => {
e.preventDefault();
console.log(e.target.getAttribute('data-kt-export'));
// Get clicked export value
const exportValue = e.target.getAttribute('data-kt-export');
const target = document.querySelector('.dt-buttons .buttons-' + exportValue);
// Trigger click event on hidden datatable export buttons
target.click();
});
});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click','.kt_edit_form',function(event){
event.preventDefault();
$.ajax({
url: $(this).attr('href'),
type: 'GET',
dataType: 'json',
success: function (response) {
console.log(response);
$('#title_form').text('Edit {{ ucfirst(str_replace('-',' ',$route[0].' '.$route[1])) }}');
$('#{{$route[0].'_'.$route[1]}}_id').val(response.id);
$('#{{$route[0].'_'.$route[1]}}_name').val(response.name);
$('.form_{{$route[0].'_'.$route[1]}}').attr('action', '{{ URL::to('/'.$route[0].'/'.$route[1].'/') }}/' + response.id).append('<input type="hidden" name="_method" value="PUT">');
$('#kt_modal_{{$route[0].'_'.$route[1]}}').modal('show');
}
})
})
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click', '.delete', function (event) {
var form = $(this).closest("form");
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}
});
}
})
})
})
</script>
@endpush
@section('styles')
<style>
.dataTables_filter {
display: none;
}
</style>
@endsection

View File

@ -1,135 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<x-default-layout>
<!--begin::Card-->
<div class="card card-xxl-stretch mb-5 mb-xl-8">
<!--begin::Card body-->
<div class="card-header border-0 pt-5">
<div class="card-title align-items-start flex-column">
<div class="d-flex align-items-center position-relative my-1">
<!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
<span class="svg-icon svg-icon-1 position-absolute ms-6">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1"
transform="rotate(45 17.0365 15.1223)" fill="currentColor"></rect>
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
</svg>
</span>
<!--end::Svg Icon-->
<input type="text" id="searchbox"
class="form-control form-control-solid border border-gray-300 w-250px ps-15"
placeholder="Search Permission">
</div>
<!--begin::Export buttons-->
<div id="kt_datatable_example_1_export" class="d-none"></div>
<!--end::Export buttons-->
</div>
<div class="card-toolbar">
<!--begin::Export dropdown-->
<button type="button" class="btn btn-light-primary" data-kt-menu-trigger="click"
data-kt-menu-placement="bottom-end">
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
Export Report
</button>
<!--begin::Menu-->
<div id="kt_datatable_example_export_menu"
class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4"
data-kt-menu="true">
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="copy">
Copy to clipboard
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="excel">
Export as Excel
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="csv">
Export as CSV
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="pdf">
Export as PDF
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="print">
Print
</a>
</div>
<!--end::Menu item-->
</div>
<!--begin::Hide default export buttons-->
<div id="kt_datatable_example_buttons" class="d-none"></div>
<!--end::Hide default export buttons-->
</div>
</div>
<div class="card-body pt-6">
@include('pages.users.permissions._table')
@include('pages.users.permissions._form')
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
$(function () {
$(".form_user_permissions").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var actionUrl = form.attr('action');
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
form[0].reset();
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
$('#kt_modal_user_permissions').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function (key, value) {
toastr.error(value);
});
}
});
});
$('#kt_modal_user_permissions').on('hidden.bs.modal', function (e) {
$(".form_user_permissions")[0].reset();
$(".form_user_permissions").attr('action', "{{ route('user.permissions.store') }}");
$(".form_user_permissions").find('input[name="_method"]').remove();
$("#title_form").html("Create Permission");
})
});
</script>
@endpush
</x-default-layout>

View File

@ -1,13 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
<a href="{{ route($route[0].'.'.$route[1].'.edit',['role' => $model->id]) }}"
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
</a>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.'.$route[1].'.destroy', $model->id],'class'=>'']) !!}
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
{!! Form::close() !!}
</div>

View File

@ -1,142 +0,0 @@
<form id="kt_modal_add_role_form" method="POST" class="form" action="{{ route('user.roles.update',['role' => $role->id]) }}">
@method('PUT')
{{ csrf_field() }}
<!--begin::Scroll-->
<div class="d-flex flex-column flex-row-fluid" id="kt_modal_add_role_scroll" data-kt-scroll="true"
data-kt-scroll-activate="{default: false, lg: true}" data-kt-scroll-max-height="auto"
data-kt-scroll-dependencies="#kt_modal_add_role_header" data-kt-scroll-wrappers="#kt_modal_add_role_scroll"
data-kt-scroll-offset="300px">
<!--begin::Input group-->
<div class="fv-row mb-7">
<!--begin::Label-->
<label class="required fw-bold fs-6 mb-2">Role Name</label>
<!--end::Label-->
<!--begin::Input-->
<div class="input-group input-group-solid has-validation mb-3">
<input type="text" name="name"
class="form-control form-control-solid mb-3 mb-lg-0 @error('name') is-invalid @enderror"
placeholder="Role name" value="{{ $role->name ?? '' }}"/>
</div>
@error('name')
<div class="text-danger">{{ $message }}</div>
@enderror
<!--end::Input-->
</div>
<!--end::Input group-->
<div class="fv-row">
<!--begin::Label-->
<label class="fs-5 fw-bolder form-label mb-2">Role Permissions</label>
<!--end::Label-->
<!--begin::Table wrapper-->
<div class="table-responsive">
<!--begin::Table-->
<table class="table align-middle table-row-dashed fs-6 gy-5">
<!--begin::Table body-->
<tbody class="text-gray-600 fw-bold">
<!--begin::Table row-->
<tr>
<td class="text-gray-800">Administrator/Superuser Access
<i class="fas fa-exclamation-circle ms-1 fs-7" data-bs-toggle="tooltip" title="Allows a full access to the system"></i></td>
<td>
<!--begin::Checkbox-->
<label class="form-check form-check-sm form-check-custom form-check-solid me-9">
<input class="form-check-input" type="checkbox" value="" id="kt_roles_select_all" />
<span class="form-check-label" for="kt_roles_select_all">Select all</span>
</label>
<!--end::Checkbox-->
</td>
</tr>
<!--end::Table row-->
@foreach($permissiongroups as $group)
<!--begin::Table row-->
<tr>
<!--begin::Label-->
<td class="text-gray-800">{{ $group->name }}</td>
<!--end::Label-->
<!--begin::Input group-->
<td>
<!--begin::Wrapper-->
<div class="d-flex">
@foreach($group->getpermissionsByGroupId($group->id) as $permission)
<!--begin::Checkbox-->
<label class="form-check form-check-sm form-check-custom form-check-solid me-5 me-lg-20">
<input class="form-check-input" type="checkbox" id="permission_{{ $permission->id }}" value="{{ $permission->id }}" name="permissions[]" {{ $role->hasPermissionTo($permission->name) ? 'checked' : null }} />
@php
$permission_name = explode('.',$permission->name);
@endphp
<span class="form-check-label text-capitalize">{{ $permission_name[1] }}</span>
</label>
<!--end::Checkbox-->
@endforeach
</div>
<!--end::Wrapper-->
</td>
<!--end::Input group-->
</tr>
<!--end::Table row-->
@endforeach
</tbody>
<!--end::Table body-->
</table>
<!--end::Table-->
</div>
<!--end::Table wrapper-->
</div>
<!--end::Permissions-->
</div>
<!--end::Scroll-->
<!--begin::Actions-->
<div class="text-center pt-15">
<a href="{{ route('user.roles.index') }}" class="btn btn-light-primary">
Cancel
</a>
<button type="submit" class="btn btn-primary" data-kt-roles-modal-action="submit">
<span class="indicator-label">Submit</span>
<span class="indicator-progress">Please wait...
<span
class="spinner-border spinner-border-sm align-middle ms-2"></span></span>
</button>
</div>
<!--end::Actions-->
</form>
@push('customscript')
<script>
"use strict";
// Class definition
var Roles = function () {
// Shared variables
const form = document.getElementById('kt_modal_add_role_form');
// Select all handler
const handleSelectAll = () => {
// Define variables
const selectAll = form.querySelector('#kt_roles_select_all');
const allCheckboxes = form.querySelectorAll('[type="checkbox"]');
// Handle check state
selectAll.addEventListener('change', e => {
// Apply check state to all checkboxes
allCheckboxes.forEach(c => {
c.checked = e.target.checked;
});
});
}
return {
// Public functions
init: function () {
handleSelectAll();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
Roles.init();
});
</script>
@endpush

View File

@ -1,160 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<div class="modal fade" id="kt_modal_user_roles" tabindex="-1" aria-hidden="true">
<!--begin::Modal dialog-->
<div class="modal-dialog modal-dialog-centered modal-fullscreen">
<!--begin::Modal content-->
<div class="modal-content rounded">
<!--begin::Modal header-->
<div class="modal-header pb-0 border-0 justify-content-end">
<!--begin::Close-->
<div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal">{!! getIcon('cross', 'fs-1') !!}</div>
<!--end::Close-->
</div>
<!--begin::Modal header-->
<!--begin::Modal body-->
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
<!--begin:Form-->
<form id="form_{{$route[0].'_'.$route[1]}}" class="form_{{$route[0].'_'.$route[1]}}" method="POST" action="{{ route($route[0].'.'.$route[1].'.store') }}">
@csrf
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0].' '.$route[1]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Name</span>
<span class="ms-1" data-bs-toggle="tooltip" title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="hidden" id="user_roles_id" name="id" />
<input type="text" id="user_roles_name" maxlength="50" class="form-control form-control-solid" placeholder="Enter Role Name" name="name" />
</div>
<!--end::Input group-->
<!--end::Input group-->
<div class="fv-row">
<!--begin::Label-->
<label class="fs-5 fw-bolder form-label mb-2">Role Permissions</label>
<!--end::Label-->
<!--begin::Table wrapper-->
<div class="table-responsive">
<!--begin::Table-->
<table class="table align-middle table-row-dashed fs-6 gy-5">
<!--begin::Table body-->
<tbody class="text-gray-600 fw-bold">
<!--begin::Table row-->
<tr>
<td class="text-gray-800">Administrator/Superuser Access
<i class="fas fa-exclamation-circle ms-1 fs-7" data-bs-toggle="tooltip" title="Allows a full access to the system"></i></td>
<td>
<!--begin::Checkbox-->
<label class="form-check form-check-sm form-check-custom form-check-solid me-9">
<input class="form-check-input" type="checkbox" value="" id="kt_roles_select_all" />
<span class="form-check-label" for="kt_roles_select_all">Select all</span>
</label>
<!--end::Checkbox-->
</td>
</tr>
<!--end::Table row-->
@foreach($permissiongroups as $group)
<!--begin::Table row-->
<tr>
<!--begin::Label-->
<td class="text-gray-800">{{ $group->name }}</td>
<!--end::Label-->
<!--begin::Input group-->
<td>
<!--begin::Wrapper-->
<div class="d-flex">
@foreach($group->getpermissionsByGroupId($group->id) as $permission)
<!--begin::Checkbox-->
<label class="form-check form-check-sm form-check-custom form-check-solid me-5 me-lg-20">
<input class="form-check-input" id="permission_{{ $permission->id }}" type="checkbox" value="{{ $permission->id }}" name="permissions[]" />
@php
$permission_name = explode('.',$permission->name);
@endphp
<span class="form-check-label text-capitalize">{{ $permission_name[1] }}</span>
</label>
<!--end::Checkbox-->
@endforeach
</div>
<!--end::Wrapper-->
</td>
<!--end::Input group-->
</tr>
<!--end::Table row-->
@endforeach
</tbody>
<!--end::Table body-->
</table>
<!--end::Table-->
</div>
<!--end::Table wrapper-->
</div>
<!--end::Permissions-->
<!--begin::Actions-->
<div class="text-center">
<button type="reset" data-bs-dismiss="modal" class="btn btn-light me-3">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
<!--end::Actions-->
</form>
<!--end:Form-->
</div>
<!--end::Modal body-->
</div>
<!--end::Modal content-->
</div>
<!--end::Modal dialog-->
</div>
<!--end::Modal - New Target-->
@push('customscript')
<script>
"use strict";
// Class definition
var Roles = function () {
// Shared variables
const form = document.getElementById('form_{{$route[0].'_'.$route[1]}}');
// Select all handler
const handleSelectAll = () => {
// Define variables
const selectAll = form.querySelector('#kt_roles_select_all');
const allCheckboxes = form.querySelectorAll('[type="checkbox"]');
// Handle check state
selectAll.addEventListener('change', e => {
// Apply check state to all checkboxes
allCheckboxes.forEach(c => {
c.checked = e.target.checked;
});
});
}
return {
// Public functions
init: function () {
handleSelectAll();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
Roles.init();
});
</script>
@endpush

View File

@ -1,99 +0,0 @@
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
{{-- Inject Scripts --}}
@section('scripts')
{{ $dataTable->scripts() }}
@endsection
@push('customscript')
@php
$route = explode('.', Route::currentRouteName());
@endphp
<script>
$("#searchbox").on("keyup search input paste cut", function () {
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].search(this.value).draw();
});
$(function () {
const documentTitle = '{{ ucfirst($route[0].' '.$route[1]) }} Report';
var buttons = new $.fn.dataTable.Buttons(LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"], {
buttons: [
{
extend: 'copyHtml5',
title: documentTitle
},
{
extend: 'excelHtml5',
title: documentTitle
},
{
extend: 'csvHtml5',
title: documentTitle
},
{
extend: 'pdfHtml5',
title: documentTitle
},
{
extend: 'print',
title: documentTitle
}
]
}).container().appendTo($('#kt_datatable_example_buttons'));
// Hook dropdown menu click event to datatable export buttons
const exportButtons = document.querySelectorAll('#kt_datatable_example_export_menu [data-kt-export]');
exportButtons.forEach(exportButton => {
exportButton.addEventListener('click', e => {
e.preventDefault();
console.log(e.target.getAttribute('data-kt-export'));
// Get clicked export value
const exportValue = e.target.getAttribute('data-kt-export');
const target = document.querySelector('.dt-buttons .buttons-' + exportValue);
// Trigger click event on hidden datatable export buttons
target.click();
});
});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click', '.delete', function (event) {
var form = $(this).closest("form");
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}
});
}
})
})
})
</script>
@endpush
@section('styles')
<style>
.dataTables_filter {
display: none;
}
</style>
@endsection

View File

@ -1,16 +0,0 @@
<x-default-layout>
<!--begin::Card-->
<div class="card card-xxl-stretch mb-5 mb-xl-8">
<!--begin::Card body-->
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
Edit Role {{ $role->name }}
</h3>
</div>
<div class="card-body pt-6">
@include('pages.users.roles._editform')
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
</x-default-layout>

View File

@ -1,135 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<x-default-layout>
<!--begin::Card-->
<div class="card card-xxl-stretch mb-5 mb-xl-8">
<!--begin::Card body-->
<div class="card-header border-0 pt-5">
<div class="card-title align-items-start flex-column">
<div class="d-flex align-items-center position-relative my-1">
<!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
<span class="svg-icon svg-icon-1 position-absolute ms-6">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1"
transform="rotate(45 17.0365 15.1223)" fill="currentColor"></rect>
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
</svg>
</span>
<!--end::Svg Icon-->
<input type="text" id="searchbox"
class="form-control form-control-solid border border-gray-300 w-250px ps-15"
placeholder="Search Role">
</div>
<!--begin::Export buttons-->
<div id="kt_datatable_example_1_export" class="d-none"></div>
<!--end::Export buttons-->
</div>
<div class="card-toolbar">
<!--begin::Export dropdown-->
<button type="button" class="btn btn-light-primary" data-kt-menu-trigger="click"
data-kt-menu-placement="bottom-end">
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
Export Report
</button>
<!--begin::Menu-->
<div id="kt_datatable_example_export_menu"
class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4"
data-kt-menu="true">
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="copy">
Copy to clipboard
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="excel">
Export as Excel
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="csv">
Export as CSV
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="pdf">
Export as PDF
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="print">
Print
</a>
</div>
<!--end::Menu item-->
</div>
<!--begin::Hide default export buttons-->
<div id="kt_datatable_example_buttons" class="d-none"></div>
<!--end::Hide default export buttons-->
</div>
</div>
<div class="card-body pt-6">
@include('pages.users.roles._table')
@include('pages.users.roles._form')
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
$(function () {
$(".form_user_roles").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var actionUrl = form.attr('action');
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
form[0].reset();
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
$('#kt_modal_user_roles').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function (key, value) {
toastr.error(value);
});
}
});
});
$('#kt_modal_user_roles').on('hidden.bs.modal', function (e) {
$(".form_user_roles")[0].reset();
$(".form_user_roles").attr('action', "{{ route('user.roles.store') }}");
$(".form_user_roles").find('input[name="_method"]').remove();
$("#title_form").html("Create Role");
})
});
</script>
@endpush
</x-default-layout>

View File

@ -1,13 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
<a href="{{ route($route[0].'.'.$route[1].'.edit',['user' => $model->id]) }}"
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
</a>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.'.$route[1].'.destroy', $model->id],'class'=>'']) !!}
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
{!! Form::close() !!}
</div>

View File

@ -1,142 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<div class="modal fade" id="kt_modal_user_users" tabindex="-1" aria-hidden="true">
<!--begin::Modal dialog-->
<div class="modal-dialog modal-dialog-centered mw-650px">
<!--begin::Modal content-->
<div class="modal-content rounded">
<!--begin::Modal header-->
<div class="modal-header pb-0 border-0 justify-content-end">
<!--begin::Close-->
<div class="btn btn-sm btn-icon btn-active-color-primary"
data-bs-dismiss="modal">{!! getIcon('cross', 'fs-1') !!}</div>
<!--end::Close-->
</div>
<!--begin::Modal header-->
<!--begin::Modal body-->
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
<!--begin:Form-->
<form class="form_{{$route[0].'_'.$route[1]}}" method="POST"
action="{{ route($route[0].'.'.$route[1].'.store') }}">
@csrf
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize"
id="title_form">{{ str_replace('-',' ',$route[0].' '.$route[1]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Name</span>
<span class="ms-1" data-bs-toggle="tooltip"
title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="hidden" id="user_users_id" name="id"/>
<input type="text" id="user_users_name" maxlength="50" class="form-control form-control-solid"
placeholder="Enter User Name" name="name"/>
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Email</span>
<span class="ms-1" data-bs-toggle="tooltip"
title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<input type="email" id="user_users_email" maxlength="50" class="form-control form-control-solid"
placeholder="Enter User Email" name="email"/>
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2" for="directorat_id">
<span class="required">Directorat</span>
<span class="ms-1" data-bs-toggle="tooltip"
title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<select class="form-select" name="directorat_id" id="directorat_id">
<option>Select Directorat</option>
@foreach($directorat as $item)
<option value="{{$item->id}}">{{$item->name}}</option>
@endforeach
</select>
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2" for="sub_directorat_id">
<span class="required">Sub Directorat</span>
<span class="ms-1" data-bs-toggle="tooltip"
title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<select class="form-select" name="sub_directorat_id" id="sub_directorat_id">
<option>Select Sub Directorat</option>
</select>
</div>
<!--end::Input group-->
<div class="mb-7">
<!--begin::Label-->
<label class="required fw-bold fs-6 mb-5">Role</label>
<!--end::Label-->
<!--begin::Roles-->
@php $n = 1; @endphp
@foreach($roles as $role)
<!--begin::Input row-->
<div class="d-flex fv-row">
<!--begin::Radio-->
<div class="form-check form-check-custom form-check-solid">
<!--begin::Input-->
<input class="form-check-input me-3" name="roles" type="radio"
value="{{ $role->id }}"
id="role_{{ Str::slug($role->name,'-') }}">
<!--end::Input-->
<!--begin::Label-->
<label class="form-check-label" for="{{ Str::slug($role->name,'-') }}">
<div class="fw-bolder text-gray-800 text-capitalize">{{ $role->name }}</div>
</label>
<!--end::Label-->
</div>
<!--end::Radio-->
</div>
@if($n < count($roles))
<div class="separator separator-dashed my-5"></div>
@endif
<!--end::Input row-->
@php $n++; @endphp
@endforeach
<!--end::Roles-->
</div>
<!--begin::Actions-->
<div class="text-center">
<button type="reset" data-bs-dismiss="modal" class="btn btn-light me-3">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
<!--end::Actions-->
</form>
<!--end:Form-->
</div>
<!--end::Modal body-->
</div>
<!--end::Modal content-->
</div>
<!--end::Modal dialog-->
</div>
<!--end::Modal - New Target-->

View File

@ -1,127 +0,0 @@
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
{{-- Inject Scripts --}}
@section('scripts')
{{ $dataTable->scripts() }}
@endsection
@push('customscript')
@php
$route = explode('.', Route::currentRouteName());
@endphp
<script>
$("#searchbox").on("keyup search input paste cut", function () {
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].search(this.value).draw();
});
$(function () {
const documentTitle = '{{ ucfirst($route[0].' '.$route[1]) }} Report';
var buttons = new $.fn.dataTable.Buttons(LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"], {
buttons: [
{
extend: 'copyHtml5',
title: documentTitle
},
{
extend: 'excelHtml5',
title: documentTitle
},
{
extend: 'csvHtml5',
title: documentTitle
},
{
extend: 'pdfHtml5',
title: documentTitle
},
{
extend: 'print',
title: documentTitle
}
]
}).container().appendTo($('#kt_datatable_example_buttons'));
// Hook dropdown menu click event to datatable export buttons
const exportButtons = document.querySelectorAll('#kt_datatable_example_export_menu [data-kt-export]');
exportButtons.forEach(exportButton => {
exportButton.addEventListener('click', e => {
e.preventDefault();
console.log(e.target.getAttribute('data-kt-export'));
// Get clicked export value
const exportValue = e.target.getAttribute('data-kt-export');
const target = document.querySelector('.dt-buttons .buttons-' + exportValue);
// Trigger click event on hidden datatable export buttons
target.click();
});
});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click','.kt_edit_form',function(event){
event.preventDefault();
$.ajax({
url: $(this).attr('href'),
type: 'GET',
dataType: 'json',
success: function (response) {
console.log(response);
$('#title_form').text('Edit {{ ucfirst(str_replace('-',' ',$route[0].' '.$route[1])) }}');
$('#directorat_id').val(response.data.directorat_id).change();
$('#sub_directorat_id').val(response.data.directorat_id).change();
$('#{{$route[0].'_'.$route[1]}}_id').val(response.data.id);
$('#{{$route[0].'_'.$route[1]}}_name').val(response.data.name);
$('#{{$route[0].'_'.$route[1]}}_email').val(response.data.email);
if(response.data.roles.length > 0){
var role = response.data.roles[0].name;
var _role = role.replace(' ','-').toLowerCase();
$("#role_"+_role).prop('checked', true);
}
$('.form_{{$route[0].'_'.$route[1]}}').attr('action', '{{ URL::to('/'.$route[0].'/'.$route[1].'/') }}/' + response.data.id).append('<input type="hidden" name="_method" value="PUT">');
$('#kt_modal_{{$route[0].'_'.$route[1]}}').modal('show');
}
})
})
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click', '.delete', function (event) {
var form = $(this).closest("form");
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}
});
}
})
})
})
</script>
@endpush
@section('styles')
<style>
.dataTables_filter {
display: none;
}
</style>
@endsection

View File

@ -1,141 +0,0 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
<x-default-layout>
<!--begin::Card-->
<div class="card card-xxl-stretch mb-5 mb-xl-8">
<!--begin::Card body-->
<div class="card-header border-0 pt-5">
<div class="card-title align-items-start flex-column">
<div class="d-flex align-items-center position-relative my-1">
<!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
<span class="svg-icon svg-icon-1 position-absolute ms-6">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1"
transform="rotate(45 17.0365 15.1223)" fill="currentColor"></rect>
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
</svg>
</span>
<!--end::Svg Icon-->
<input type="text" id="searchbox"
class="form-control form-control-solid border border-gray-300 w-250px ps-15"
placeholder="Search User">
</div>
<!--begin::Export buttons-->
<div id="kt_datatable_example_1_export" class="d-none"></div>
<!--end::Export buttons-->
</div>
<div class="card-toolbar">
<!--begin::Export dropdown-->
<button type="button" class="btn btn-light-primary" data-kt-menu-trigger="click"
data-kt-menu-placement="bottom-end">
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
Export Report
</button>
<!--begin::Menu-->
<div id="kt_datatable_example_export_menu"
class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4"
data-kt-menu="true">
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="copy">
Copy to clipboard
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="excel">
Export as Excel
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="csv">
Export as CSV
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="pdf">
Export as PDF
</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-export="print">
Print
</a>
</div>
<!--end::Menu item-->
</div>
<!--begin::Hide default export buttons-->
<div id="kt_datatable_example_buttons" class="d-none"></div>
<!--end::Hide default export buttons-->
</div>
</div>
<div class="card-body pt-6">
@include('pages.users.users._table')
@include('pages.users.users._form')
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
$(function () {
$(".form_user_users").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var actionUrl = form.attr('action');
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
form[0].reset();
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
$('#kt_modal_user_users').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function (key, value) {
toastr.error(value);
});
}
});
});
$('#kt_modal_user_users').on('hidden.bs.modal', function (e) {
$(".form_user_users")[0].reset();
$("#sub_directorat_id").html("").append("<option value=''>Select Sub Directorat</option>");
$(".form_user_users").attr('action', "{{ route('user.users.store') }}");
$(".form_user_users").find('input[name="_method"]').remove();
$("#title_form").html("Create User");
});
$("#sub_directorat_id").remoteChained({
parents : "#directorat_id",
url : "/sub-directorat"
});
});
</script>
@endpush
</x-default-layout>

View File

@ -1,20 +1,20 @@
<?php
use App\Http\Controllers\Auth\AuthApiController as AuthApiControllerAlias;
use App\Http\Controllers\DirectoratController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\DirectoratController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Modules\UserManager\Http\Controllers\Auth\AuthApiController as AuthApiControllerAlias;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::post('register', [AuthApiControllerAlias::class, 'register']);
Route::post('login', [AuthApiControllerAlias::class, 'login']);

View File

@ -1,56 +0,0 @@
<?php
use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\ConfirmablePasswordController;
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
use App\Http\Controllers\Auth\EmailVerificationPromptController;
use App\Http\Controllers\Auth\NewPasswordController;
use App\Http\Controllers\Auth\PasswordResetLinkController;
use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route;
Route::middleware('guest')->group(function () {
Route::get('register', [RegisteredUserController::class, 'create'])
->name('register');
Route::post('register', [RegisteredUserController::class, 'store']);
Route::get('login', [AuthenticatedSessionController::class, 'create'])
->name('login');
Route::post('login', [AuthenticatedSessionController::class, 'store']);
Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
->name('password.request');
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
->name('password.email');
Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
->name('password.reset');
Route::post('reset-password', [NewPasswordController::class, 'store'])
->name('password.update');
});
Route::middleware('auth')->group(function () {
Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke'])
->name('verification.notice');
Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
->middleware(['signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware('throttle:6,1')
->name('verification.send');
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
->name('password.confirm');
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
Route::get('logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout');
});

View File

@ -1,6 +1,6 @@
<?php
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DocumentController;
use App\Http\Controllers\DocumentTypeController;
use App\Http\Controllers\JobController;
@ -9,46 +9,28 @@ use App\Http\Controllers\DashboardController;
use App\Http\Controllers\SpecialCodeController;
use App\Http\Controllers\SubDirectoratController;
use App\Http\Controllers\SubJobController;
use App\Http\Controllers\SubSubJobController;
use App\Http\Controllers\Users\PermissionsController;
use App\Http\Controllers\Users\RolesController;
use App\Http\Controllers\Users\UsersController;
use App\Http\Controllers\SubSubJobController;
use Illuminate\Support\Facades\Route;
use Modules\UserManager\Http\Controllers\Users\PermissionsController;
use Modules\UserManager\Http\Controllers\Users\RolesController;
use Modules\UserManager\Http\Controllers\Users\UsersController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group(['middleware' => ['auth', 'verified']], function () {
Route::get('/', [DashboardController::class, 'index'])->middleware(['auth', 'verified']);
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
// Master Data Cetak Label
Route::prefix('master')->name('master.')->group(function(){
});
// Users Management
Route::prefix('user')->name('user.')->group(function(){
Route::resource('roles', RolesController::class);
Route::resource('permissions', PermissionsController::class);
Route::resource('users', UsersController::class);
});
});
Route::get('/error', function () {
abort(500);
});
require __DIR__.'/auth.php';

View File

@ -2,9 +2,9 @@
namespace Tests\Feature\Auth;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Modules\UserManager\Entities\User;
use Tests\TestCase;
class AuthenticationTest extends TestCase

View File

@ -2,12 +2,12 @@
namespace Tests\Feature\Auth;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\URL;
use Modules\UserManager\Entities\User;
use Tests\TestCase;
class EmailVerificationTest extends TestCase

View File

@ -2,8 +2,8 @@
namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Modules\UserManager\Entities\User;
use Tests\TestCase;
class PasswordConfirmationTest extends TestCase

View File

@ -2,10 +2,10 @@
namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Notification;
use Modules\UserManager\Entities\User;
use Tests\TestCase;
class PasswordResetTest extends TestCase