Reformat Codes

This commit is contained in:
daeng.deni@dharma.or.id 2023-05-21 12:37:35 +07:00
parent 514c2d4222
commit 2a2fb1c856
34 changed files with 885 additions and 879 deletions

View File

@ -1,5 +1,5 @@
<?php
return [
return [
'name' => 'Usermanager'
];
];

View File

@ -12,6 +12,7 @@
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
@ -24,12 +25,12 @@
$query->where('name', 'like', "%" . $search['value'] . "%");
}
})
->rawColumns(['action','role'])
->rawColumns(['action', 'role'])
->addIndexColumn()
->addColumn('name', function (PermissionGroup $model) {
return $model->name;
})
->addColumn('role', function (PermissionGroup $model){
->addColumn('role', function (PermissionGroup $model) {
$role = $model->roles($model);
return view('usermanager::users.permissions._checkbox', compact('role'));
})
@ -61,7 +62,7 @@
->setTableId('user-permissions-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->orderBy(1, 'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
@ -94,9 +95,11 @@
/**
* Get filename for export
*
* @return string
*/
protected function filename() : string
protected function filename()
: string
{
return 'Permissions_' . date('YmdHis');
}

View File

@ -2,16 +2,17 @@
namespace Modules\Usermanager\DataTables;
use Spatie\Permission\Models\Role;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
use Spatie\Permission\Models\Role;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class RolesDataTable extends DataTable
{
class RolesDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
@ -35,6 +36,7 @@ class RolesDataTable extends DataTable
* Get query source of dataTable.
*
* @param \Spatie\Permission\Models\Role $model
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Role $model)
@ -53,7 +55,7 @@ class RolesDataTable extends DataTable
->setTableId('user-roles-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->orderBy(1, 'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
@ -89,8 +91,9 @@ class RolesDataTable extends DataTable
*
* @return string
*/
protected function filename() : string
protected function filename()
: string
{
return 'Roles_' . date('YmdHis');
}
}
}

View File

@ -2,16 +2,17 @@
namespace Modules\Usermanager\DataTables;
use Modules\Usermanager\Entities\User;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
use Modules\Usermanager\Entities\User;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
{
class UsersDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
@ -21,7 +22,7 @@ class UsersDataTable extends DataTable
->eloquent($query)
->filter(function ($query) {
$search = request()->get('search');
if ($search['value']!=="") {
if ($search['value'] !== "") {
$query->where('name', 'like', "%" . $search['value'] . "%")
->orWhere('email', 'like', "%" . $search['value'] . "%");
}
@ -56,7 +57,7 @@ class UsersDataTable extends DataTable
->setTableId('user-users-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->orderBy(1, 'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
@ -91,8 +92,9 @@ class UsersDataTable extends DataTable
*
* @return string
*/
protected function filename() : string
protected function filename()
: string
{
return 'Users_' . date('YmdHis');
}
}
}

View File

@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -38,4 +37,4 @@ return new class extends Migration
{
Schema::dropIfExists('users');
}
};
};

View File

@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -34,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('password_resets');
}
};
};

View File

@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -38,4 +37,4 @@ return new class extends Migration
{
Schema::dropIfExists('failed_jobs');
}
};
};

View File

@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -39,4 +38,4 @@ return new class extends Migration
{
Schema::dropIfExists('personal_access_tokens');
}
};
};

View File

@ -1,12 +1,12 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\PermissionRegistrar;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Spatie\Permission\PermissionRegistrar;
class CreatePermissionTables extends Migration
{
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
@ -19,10 +19,10 @@ class CreatePermissionTables extends Migration
$teams = config('permission.teams');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
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.');
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) {
@ -129,7 +129,7 @@ class CreatePermissionTables extends Migration
$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.');
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']);
@ -138,4 +138,4 @@ class CreatePermissionTables extends Migration
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}
}

View File

@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*

View File

@ -4,14 +4,14 @@
use Illuminate\Support\Facades\Schema;
use Modules\Usermanager\Entities\PermissionGroup;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
public function up()
: void
{
Schema::table('permissions', function($table) {
Schema::table('permissions', function ($table) {
$table->foreignIdFor(PermissionGroup::class);
});
}
@ -19,9 +19,10 @@
/**
* Reverse the migrations.
*/
public function down(): void
public function down()
: void
{
Schema::dropForeignKey('permission_group_id');
Schema::dropColumn('permission_group_id');
}
};
};

View File

@ -1,12 +1,12 @@
<?php
namespace Modules\Usermanager\Database\Seeders;
namespace Modules\Usermanager\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;
class UserManagerDatabaseSeeder extends Seeder
{
class UserManagerDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
@ -23,4 +23,4 @@ class UserManagerDatabaseSeeder extends Seeder
UsersSeeder::class
]);
}
}
}

View File

@ -1,15 +1,15 @@
<?php
namespace Modules\Usermanager\Database\factories;
namespace Modules\Usermanager\Database\factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Modules\Usermanager\Entities\User>
*/
class UserFactory extends Factory
{
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
@ -33,8 +33,8 @@ class UserFactory extends Factory
*/
public function unverified()
{
return $this->state(fn (array $attributes) => [
return $this->state(fn(array $attributes) => [
'email_verified_at' => null,
]);
}
}
}

View File

@ -1,16 +1,17 @@
<?php
namespace Modules\Usermanager\Entities;
namespace Modules\Usermanager\Entities;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Permission as SpatiePermission;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Permission as SpatiePermission;
class Permission extends SpatiePermission
{
class Permission extends SpatiePermission
{
use LogsActivity;
public function getActivitylogOptions(): LogOptions
public function getActivitylogOptions()
: LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
@ -20,4 +21,4 @@ class Permission extends SpatiePermission
{
return $this->hasOne(PermissionGroup::class);
}
}
}

View File

@ -16,7 +16,8 @@
*
* @return \Illuminate\Http\Response
*/
public function register(Request $request): JsonResponse
public function register(Request $request)
: JsonResponse
{
$validator = Validator::make($request->all(), [
'name' => 'required',
@ -43,7 +44,8 @@
*
* @return \Illuminate\Http\Response
*/
public function login(Request $request): JsonResponse
public function login(Request $request)
: JsonResponse
{
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
$user = Auth::user();

View File

@ -39,7 +39,7 @@
// Store the Role...
if ($validated) {
try {
if(!isset($validated['guard_name'])){
if (!isset($validated['guard_name'])) {
$validated['guard_name'] = 'default';
}
@ -53,7 +53,6 @@
}
return $this->sendResponse($role, 'Role created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
@ -72,7 +71,7 @@
// Store the Role...
if ($validated) {
try {
if(!isset($validated['guard_name'])){
if (!isset($validated['guard_name'])) {
$validated['guard_name'] = 'default';
}

View File

@ -39,7 +39,7 @@
addVendor('chained-select');
$roles = Role::all();
return $dataTable->render('usermanager::users.users.index', compact( 'roles'));
return $dataTable->render('usermanager::users.users.index', compact('roles'));
}
/**

View File

@ -1,12 +1,12 @@
<?php
namespace Modules\Usermanager\Providers;
namespace Modules\Usermanager\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
class RouteServiceProvider extends ServiceProvider
{
/**
* The module namespace to assume when generating URLs to actions.
*
@ -37,20 +37,6 @@ class RouteServiceProvider extends ServiceProvider
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->moduleNamespace)
->group(module_path('Usermanager', '/Routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
@ -65,4 +51,18 @@ class RouteServiceProvider extends ServiceProvider
->namespace($this->moduleNamespace)
->group(module_path('Usermanager', '/Routes/api.php'));
}
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->moduleNamespace)
->group(module_path('Usermanager', '/Routes/web.php'));
}
}

View File

@ -1,12 +1,13 @@
<?php
namespace Modules\Usermanager\Providers;
namespace Modules\Usermanager\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Config;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\ServiceProvider;
class UsermanagerServiceProvider extends ServiceProvider
{
class UsermanagerServiceProvider extends ServiceProvider
{
/**
* @var string $moduleName
*/
@ -31,13 +32,21 @@ class UsermanagerServiceProvider extends ServiceProvider
}
/**
* Register the service provider.
* Register translations.
*
* @return void
*/
public function register()
public function registerTranslations()
{
$this->app->register(RouteServiceProvider::class);
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
}
}
/**
@ -73,22 +82,26 @@ class UsermanagerServiceProvider extends ServiceProvider
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
}
private function getPublishableViewPaths()
: array
{
$paths = [];
foreach (Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
/**
* Register translations.
* Register the service provider.
*
* @return void
*/
public function registerTranslations()
public function register()
{
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
}
$this->app->register(RouteServiceProvider::class);
}
/**
@ -100,15 +113,4 @@ class UsermanagerServiceProvider extends ServiceProvider
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (\Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
}

View File

@ -2,7 +2,7 @@
<x-auth-card>
<x-slot name="logo">
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
<x-application-logo class="w-20 h-20 fill-current text-gray-500"/>
</a>
</x-slot>
@ -14,31 +14,31 @@
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<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-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" />
<x-input-error :messages="$errors->get('email')" class="mt-2"/>
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-input-label for="password" :value="__('Password')"/>
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required />
<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" />
<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-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 />
name="password_confirmation" required/>
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2"/>
</div>
<div class="flex items-center justify-end mt-4">

View File

@ -15,7 +15,7 @@
@endphp
@foreach($role as $row)
<a href="javascript:;" class="text-capitalize badge {{ $color[$row->id] }} fs-7 m-1">{{ $row->name }}</a>
<a href="javascript:" class="text-capitalize badge {{ $color[$row->id] }} fs-7 m-1">{{ $row->name }}</a>
@php $i++ @endphp
@endforeach
</td>

View File

@ -2,7 +2,7 @@
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<!--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">
@ -35,8 +35,8 @@
<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" />
<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-->

View File

@ -59,7 +59,7 @@
});
});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click','.kt_edit_form',function(event){
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click', '.kt_edit_form', function (event) {
event.preventDefault();
$.ajax({
url: $(this).attr('href'),
@ -93,8 +93,7 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
success: function (data) {
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}

View File

@ -1,7 +1,7 @@
<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-->
@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"
@ -36,11 +36,12 @@
<!--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>
<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" />
<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-->

View File

@ -2,7 +2,7 @@
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin::Modal - New Target-->
<!--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">
@ -35,8 +35,8 @@
<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" />
<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-->
@ -54,11 +54,12 @@
<!--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>
<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" />
<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-->
@ -78,7 +79,7 @@
@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[]" />
<input class="form-check-input" id="permission_{{ $permission->id }}" type="checkbox" value="{{ $permission->id }}" name="permissions[]"/>
@php
$permission_name = explode('.',$permission->name);
@endphp

View File

@ -76,8 +76,7 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
success: function (data) {
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}

View File

@ -59,7 +59,7 @@
});
});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click','.kt_edit_form',function(event){
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].on('click', '.kt_edit_form', function (event) {
event.preventDefault();
$.ajax({
url: $(this).attr('href'),
@ -72,11 +72,11 @@
$('#{{$route[0].'_'.$route[1]}}_name').val(response.data.name);
$('#{{$route[0].'_'.$route[1]}}_email').val(response.data.email);
if(response.data.roles.length > 0){
if (response.data.roles.length > 0) {
var role = response.data.roles[0].name;
var _role = role.replace(' ','-').toLowerCase();
var _role = role.replace(' ', '-').toLowerCase();
$("#role_"+_role).prop('checked', true);
$("#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">');
@ -102,8 +102,7 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
success: function (data) {
toastr.success('{{ucfirst($route[0].' '.$route[1])}} has been deleted.', 'Success!', {timeOut: 5000});
LaravelDataTables["{{$route[0].'-'.$route[1]}}-table"].ajax.reload();
}

View File

@ -32,9 +32,9 @@
Route::post('reset-password', [NewPasswordController::class, 'store'])
->name('password.update');
});
});
Route::middleware('auth')->group(function () {
Route::middleware('auth')->group(function () {
Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke'])
->name('verification.notice');
@ -53,4 +53,4 @@ Route::middleware('auth')->group(function () {
Route::get('logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout');
});
});

View File

@ -12,7 +12,6 @@
"laravel": {
"providers": [],
"aliases": {
}
}
},