working on omis setup
This commit is contained in:
parent
4f34db3381
commit
09222c8a3a
@ -6,12 +6,20 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\User\Repositories\UserRepository;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
|
||||
protected $userRepository;
|
||||
|
||||
public function __construct(UserRepository $userRepository){
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = User::latest()->get();
|
||||
@ -25,6 +33,7 @@ class UserController extends Controller
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create User";
|
||||
$data['users'] = User::latest()->get();
|
||||
return view('user::create', $data);
|
||||
}
|
||||
|
||||
@ -33,12 +42,21 @@ class UserController extends Controller
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
$validatedData = $request->validate([
|
||||
'name' => 'required|min:5',
|
||||
'email' => 'required',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
$user = $this->userRepository->create($validatedData, $request->role);
|
||||
toastr()->success('User has been created!');
|
||||
return redirect()->route('users.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return view('user::show');
|
||||
|
12
Modules/User/app/Repositories/UserInterface.php
Normal file
12
Modules/User/app/Repositories/UserInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Repositories;
|
||||
|
||||
interface UserInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getUserById($userId);
|
||||
public function delete($userId);
|
||||
public function create(array $UserDetails, array $role);
|
||||
public function update($userId, array $newDetails);
|
||||
}
|
35
Modules/User/app/Repositories/UserRepository.php
Normal file
35
Modules/User/app/Repositories/UserRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Repositories;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserRepository implements UserInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return User::get();
|
||||
}
|
||||
|
||||
public function getUserById($userId)
|
||||
{
|
||||
return User::findOrFail($userId);
|
||||
}
|
||||
|
||||
public function delete($userId)
|
||||
{
|
||||
User::destroy($userId);
|
||||
}
|
||||
|
||||
public function create(array $userDetails, array $role)
|
||||
{
|
||||
$user = User::create($userDetails);
|
||||
return $user->roles()->attach($role);
|
||||
}
|
||||
|
||||
public function update($userId, array $newDetails)
|
||||
{
|
||||
return User::whereId($userId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
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('users', function (Blueprint $table) {
|
||||
$table->unsignedInteger('employee_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
|
||||
});
|
||||
}
|
||||
};
|
@ -15,13 +15,12 @@
|
||||
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
|
||||
|
@ -6,56 +6,46 @@
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h4>{{ label('Users List') }}</h4>
|
||||
<a href="{{ route('user.create') }}" class="btn btn-info"><span>{{ label('Create New') }}</span></a>
|
||||
<div class="card-header d-flex justify-content-between align-users-center">
|
||||
<h5 class="card-title flex-grow-1 mb-0">User Lists</h5>
|
||||
<a href="{{ route('user.create') }}" class="btn btn-info btn-sm"><span>Add New</span></a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead class="">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Name') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Email') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('User Name') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Role') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Branch') }}</span></th>
|
||||
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Employee') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
<th class="tb-col"><span class="overline-title">S.N</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Name</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Email</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Employee</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Role</span></th>
|
||||
{{-- <th class="tb-col"><span class="overline-title">Branch</span></th> --}}
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">Action</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->id }}" data-display_order="{{ $item->display_order }}"
|
||||
@foreach ($data as $index => $user)
|
||||
<tr data-id="{{ $user->id }}" data-display_order="{{ $user->display_order }}"
|
||||
class="draggable-row">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $item->name }}</td>
|
||||
<td class="tb-col">{{ $item->email }}</td>
|
||||
<td class="tb-col">{{ $item->username }}</td>
|
||||
<td class="tb-col">{!! getFieldData('tbl_roles', 'title', 'role_id', $item->roles_id) !!}
|
||||
<td class="tb-col">{!! getFieldData('tbl_branches', 'title', 'branch_id', $item->branches_id) !!}
|
||||
|
||||
<td class="tb-col">{!! getFieldData('tbl_employees', 'title', 'employee_id', $item->employees_id) !!}
|
||||
</td>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $user->name }}</td>
|
||||
<td class="tb-col">{{ $user->email }}</td>
|
||||
<td class="tb-col">{{ optional($user->employee)->employee_id }}</td>
|
||||
<td class="tb-col">{{ $user->roles->first()->id }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal"
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-user-btn" data-bs-toggle="modal"
|
||||
data-bs-target="#viewModal">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
<a href="{{ route('user.edit', $item->id) }}" class="link-success fs-15 edit-item-btn"><i
|
||||
<a href="{{ route('user.edit', $user->id) }}" class="link-success fs-15 edit-user-btn"><i
|
||||
class="ri-edit-2-line"></i></a>
|
||||
|
||||
<a href="javascript:void(0);" data-link="{{ route('user.destroy', $item->id) }}"
|
||||
data-id="{{ $item->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
<a href="javascript:void(0);" data-link="{{ route('user.destroy', $user->id) }}"
|
||||
data-id="{{ $user->id }}" class="link-danger fs-15 remove-user-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,23 +1,33 @@
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<input type="text" class="form-control" id="name" placeholder="Enter name" name="name"
|
||||
value="{{ old('end_date', $leave->name ?? '') }}" required>
|
||||
<div class="invalid-feedback">
|
||||
Please enter employee name.
|
||||
<div class="row gy-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('For Employee')->class('form-label') }}
|
||||
{{ html()->select('employee_id', ['1', '2'])->class('form-select')->placeholder('Select Employee')->required() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
value="{{ old('email', $leave->email ?? '') }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Role')->class('form-label') }}
|
||||
{{ html()->select('role_id', ['1', '2'])->class('form-select')->placeholder('Select Role')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Username')->class('form-label') }}
|
||||
{{ html()->text('name')->class('form-control')->placeholder('Enter Username')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Password')->class('form-label') }}
|
||||
{{ html()->password('password')->class('form-control')->placeholder('Enter Password')->required() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary">{{ $btnType }}</button>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
||||
|
@ -51,7 +51,7 @@ class OMIS
|
||||
<?php echo $text; ?>
|
||||
</span></a>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function getSiteVars()
|
||||
|
@ -2,7 +2,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country\Country;
|
||||
use App\Models\Country;
|
||||
use App\Service\CommonModelService;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,39 +2,39 @@
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Proviences;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class ProviencesController extends Controller
|
||||
class ProvinceController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Proviences $model)
|
||||
public function __construct(Province $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'index', ' Proviences index');
|
||||
$data = Proviences::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
createActivityLog(ProvinceController::class, 'index', ' Province index');
|
||||
$data = Province::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.proviences.index", compact('data'));
|
||||
return view("crud.generated.province.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'create', ' Proviences create');
|
||||
$TableData = Proviences::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
createActivityLog(ProvinceController::class, 'create', ' Province create');
|
||||
$TableData = Province::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.proviences.edit",compact('TableData','editable'));
|
||||
return view("crud.generated.province.edit",compact('TableData','editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'store', ' Proviences store');
|
||||
createActivityLog(ProvinceController::class, 'store', ' Province store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -45,7 +45,7 @@
|
||||
],500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_proviences')]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_province')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData=$request->all();
|
||||
@ -62,14 +62,14 @@
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProviencesController::class, 'store', $e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Proviences Created Successfully.'], 200);
|
||||
return response()->json(['status' => true, 'message' => 'The Province Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('proviences.index')->with('success','The Proviences created Successfully.');
|
||||
return redirect()->route('province.index')->with('success','The Province created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
@ -77,7 +77,7 @@
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Proviences::find($id);
|
||||
$companyArticle = Province::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
@ -89,7 +89,7 @@
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Proviences::find($articleId);
|
||||
$companyArticle = Province::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
@ -103,26 +103,26 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'show', ' Proviences show');
|
||||
$data = Proviences::findOrFail($id);
|
||||
createActivityLog(ProvinceController::class, 'show', ' Province show');
|
||||
$data = Province::findOrFail($id);
|
||||
|
||||
return view("crud.generated.proviences.show", compact('data'));
|
||||
return view("crud.generated.province.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'edit', ' Proviences edit');
|
||||
$TableData = Proviences::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$data = Proviences::findOrFail($id);
|
||||
createActivityLog(ProvinceController::class, 'edit', ' Province edit');
|
||||
$TableData = Province::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$data = Province::findOrFail($id);
|
||||
$editable=true;
|
||||
return view("crud.generated.proviences.edit", compact('data','TableData','editable'));
|
||||
return view("crud.generated.province.edit", compact('data','TableData','editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'update', ' Proviences update');
|
||||
createActivityLog(ProvinceController::class, 'update', ' Province update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -146,20 +146,20 @@
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProviencesController::class, 'update', $e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Proviences updated Successfully.'], 200);
|
||||
return response()->json(['status' => true, 'message' => 'The Province updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('proviences.index')->with('success','The Proviences updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Proviences updated successfully.');
|
||||
// return redirect()->route('province.index')->with('success','The Province updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Province updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'destroy', ' Proviences destroy');
|
||||
createActivityLog(ProvinceController::class, 'destroy', ' Province destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -167,16 +167,16 @@
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProviencesController::class, 'destroy', $e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Proviences Deleted Successfully.'],200);
|
||||
return response()->json(['status'=>true,'message'=>'The Province Deleted Successfully.'],200);
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'destroy', ' Proviences destroy');
|
||||
$data = Proviences::findOrFail($id);
|
||||
createActivityLog(ProvinceController::class, 'destroy', ' Province destroy');
|
||||
$data = Province::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
@ -185,16 +185,16 @@
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProviencesController::class, 'destroy', $e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Proviences Deleted Successfully.'],200);
|
||||
return response()->json(['status'=>true,'message'=>'The Province Deleted Successfully.'],200);
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
{
|
||||
createActivityLog(ProviencesController::class, 'clone', ' Proviences clone');
|
||||
$data = Proviences::findOrFail($id);
|
||||
createActivityLog(ProvinceController::class, 'clone', ' Province clone');
|
||||
$data = Province::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData=$data->toArray();
|
||||
@ -205,14 +205,13 @@
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProviencesController::class, 'clone', $e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Proviences Clonned Successfully.'],200);
|
||||
return response()->json(['status'=>true,'message'=>'The Province Clonned Successfully.'],200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\DataTables\UsersDataTable;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
$roles = Role::all();
|
||||
return view('users.create', compact('roles'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'name' => 'required|min:5',
|
||||
'email' => 'required',
|
||||
'password' => 'required',
|
||||
'role' => 'required',
|
||||
]);
|
||||
$user = User::create($validatedData);
|
||||
$user->roles()->attach($request->role);
|
||||
toastr()->success('User has been created!');
|
||||
return redirect()->route('users.index');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$users = User::latest()->get();
|
||||
return view('users.index', compact('users'));
|
||||
}
|
||||
|
||||
public function destroy(string $id)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
$user->delete();
|
||||
toastr()->success('Data has been deleted successfully!');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
16
app/Models/Companytypes.php
Normal file
16
app/Models/Companytypes.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Companytypes extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_companytypes';
|
||||
protected $primaryKey = 'companytype_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Country;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\District;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Eligibility;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Eligibility extends Model
|
||||
{
|
||||
protected $table = 'tbl_eligibilities';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'stream',
|
||||
'program_id',
|
||||
'level',
|
||||
'grade',
|
||||
'display_order',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_on',
|
||||
];
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Fee;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Fee extends Model
|
||||
{
|
||||
protected $table = 'tbl_fees';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'program_id',
|
||||
'type',
|
||||
'amount',
|
||||
'display_order',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_on',
|
||||
];
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\FollowUp;
|
||||
|
||||
use App\Modules\Models\LeadCategory\LeadCategory;
|
||||
use App\Modules\Models\Registration\Registration;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FollowUp extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_follow_ups';
|
||||
|
||||
protected $fillable = [
|
||||
'refrence_id',
|
||||
'follow_up_type',
|
||||
'next_schedule',
|
||||
'follow_up_name',
|
||||
'follow_up_by',
|
||||
'remarks',
|
||||
'leadcategory_id',
|
||||
'status',
|
||||
'created_by',
|
||||
'last_updated_by'
|
||||
];
|
||||
|
||||
public static function registration($id)
|
||||
{
|
||||
$query = DB::select("SELECT f.id,r.name,r.email,r.phone,f.next_schedule,f.follow_up_by,f.remarks FROM tbl_registrations r INNER JOIN tbl_follow_ups f ON f.refrence_id = r.id AND f.follow_up_type = 'registration' AND f.id = $id");
|
||||
if(!empty($query)) {
|
||||
return $query[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Intake;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Intake extends Model
|
||||
{
|
||||
protected $table = 'tbl_intakes';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'program_id',
|
||||
'intake_date',
|
||||
'class_commencement',
|
||||
'deadline_date',
|
||||
'display_order',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_on',
|
||||
];
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\LeadCategory;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LeadCategory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_leadcategories';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'color_code',
|
||||
'status',
|
||||
];
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Location;
|
||||
|
||||
use App\Modules\Models\Registration\Registration;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Location extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_locations';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'email',
|
||||
'password',
|
||||
'description',
|
||||
'status',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function registrations()
|
||||
{
|
||||
return $this->hasMany(Registration::class,'preffered_location','slug');
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Municipality;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Permission;
|
||||
namespace App\Models;
|
||||
|
||||
use App\Modules\Models\User;
|
||||
use App\Modules\Models\Role;
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Program;
|
||||
|
||||
use App\Modules\Models\Criteria\Criteria;
|
||||
use App\Modules\Models\Eligibility\Eligibility;
|
||||
use App\Modules\Models\Fee\Fee;
|
||||
use App\Modules\Models\Intake\Intake;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Program extends Model
|
||||
{
|
||||
protected $table = 'tbl_programs';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'checklist_documents',
|
||||
'image',
|
||||
'contact_person',
|
||||
'contact_email',
|
||||
'contact_number',
|
||||
'special_instruction',
|
||||
'display_order',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_on',
|
||||
];
|
||||
|
||||
public function intakes()
|
||||
{
|
||||
return $this->hasMany(Intake::class,'program_id','id');
|
||||
}
|
||||
|
||||
public function fees()
|
||||
{
|
||||
return $this->hasMany(Fee::class,'program_id','id');
|
||||
}
|
||||
|
||||
public function eligibilities()
|
||||
{
|
||||
return $this->hasMany(Eligibility::class,'program_id','id');
|
||||
}
|
||||
|
||||
public function criterias()
|
||||
{
|
||||
return $this->hasMany(Criteria::class,'program_id','id');
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Province;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Qualification;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Qualification extends Model
|
||||
{
|
||||
protected $table = 'tbl_qualifications';
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'status',
|
||||
];
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Registration;
|
||||
|
||||
use App\Modules\Models\Campaign\Campaign;
|
||||
use App\Modules\Models\FollowUp\FollowUp;
|
||||
use App\Modules\Models\LeadCategory\LeadCategory;
|
||||
use App\Modules\Models\Student\Student;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Registration extends Model
|
||||
{
|
||||
protected $table = 'tbl_registrations';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'campaign_id',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'address',
|
||||
'city',
|
||||
'state',
|
||||
'zone',
|
||||
'nearest_landmark',
|
||||
'preffered_location',
|
||||
'see_year',
|
||||
'see_grade',
|
||||
'headers',
|
||||
'country_id',
|
||||
'state_id',
|
||||
'district_id',
|
||||
'municipality_name',
|
||||
'ward_no',
|
||||
'village_name',
|
||||
'full_address',
|
||||
'user_agent',
|
||||
'see_stream',
|
||||
'see_school',
|
||||
'plus2_year',
|
||||
'plus2_grade',
|
||||
'plus2_stream',
|
||||
'plus2_college',
|
||||
'bachelors_year',
|
||||
'bachelors_grade',
|
||||
'bachelors_stream',
|
||||
'bachelors_college',
|
||||
'highest_qualification',
|
||||
'highest_grade',
|
||||
'highest_stream',
|
||||
'highest_college',
|
||||
'preparation_class',
|
||||
'preparation_score',
|
||||
'preparation_bandscore',
|
||||
'preparation_date',
|
||||
'test_name',
|
||||
'coupen_code',
|
||||
'test_score',
|
||||
'intrested_for_country',
|
||||
'intrested_course',
|
||||
'source',
|
||||
'display_order',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_on',
|
||||
];
|
||||
|
||||
public static function getFollowUp($id)
|
||||
{
|
||||
return FollowUp::select('id','next_schedule','follow_up_name','follow_up_by','remarks')->where('follow_up_type','registration')->where('refrence_id',$id)->latest()->first();
|
||||
}
|
||||
|
||||
public static function getFollowUpCount($id)
|
||||
{
|
||||
return FollowUp::select('id','next_schedule','follow_up_name','follow_up_by','remarks')->where('follow_up_type','registration')->where('refrence_id',$id)->latest()->get();
|
||||
}
|
||||
|
||||
public function leadcategory()
|
||||
{
|
||||
return $this->belongsTo(LeadCategory::class);
|
||||
}
|
||||
|
||||
public function campaign()
|
||||
{
|
||||
return $this->belongsTo(Campaign::class);
|
||||
}
|
||||
|
||||
public function enroll($id) {
|
||||
return Student::select('id')->where('source_ref','registration')->where('ref_id',$id)->latest()->first();
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Role;
|
||||
|
||||
use App\Modules\Models\Permission\Permission;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable= [
|
||||
'name', 'slug', 'visibility','status', 'availability','is_deleted',
|
||||
'deleted_at','created_by','last_updated_by','last_deleted_by'
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'visibility_text', 'status_text', 'availability_text', 'thumbnail_path', 'image_path'
|
||||
];
|
||||
|
||||
public function permissions(){
|
||||
return $this->belongsToMany(Permission::class,'role_has_permissions');
|
||||
}
|
||||
|
||||
function getVisibilityTextAttribute(){
|
||||
return ucwords(str_replace('_', ' ', $this->visibility));
|
||||
}
|
||||
|
||||
function getStatusTextAttribute(){
|
||||
return ucwords(str_replace('_', ' ', $this->status));
|
||||
}
|
||||
|
||||
function getAvailabilityTextAttribute(){
|
||||
return ucwords(str_replace('_', ' ', $this->availability));
|
||||
}
|
||||
|
||||
function creator(){
|
||||
return $this->belongsTo(User::class,'created_by');
|
||||
}
|
||||
|
||||
function getImagePathAttribute(){
|
||||
return $this->path.'/'. $this->image;
|
||||
}
|
||||
|
||||
function getThumbnailPathAttribute(){
|
||||
return $this->path.'/thumb/'. $this->image;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Setting;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\State;
|
||||
namespace App\Models;
|
||||
|
||||
use App\Modules\Models\Country\Country;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use App\Modules\Models\Admission\Admission;
|
||||
use App\Modules\Models\Agent\Agent;
|
||||
use App\Modules\Models\Country\Country;
|
||||
use App\Modules\Models\District\District;
|
||||
use App\Modules\Models\Location\Location;
|
||||
use App\Modules\Models\State\State;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Student extends Model
|
||||
{
|
||||
|
||||
protected $table = 'tbl_students';
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'applicant',
|
||||
'first_name',
|
||||
'middle_name',
|
||||
'last_name',
|
||||
'gender',
|
||||
'material_status',
|
||||
'spouse_name',
|
||||
'father_name',
|
||||
'mother_name',
|
||||
'mobile_no',
|
||||
'alternate_mobile_no',
|
||||
'email',
|
||||
'dob',
|
||||
'country_id',
|
||||
'state_id',
|
||||
'source_ref',
|
||||
'ref_id',
|
||||
'district_id',
|
||||
'municipality_name',
|
||||
'ward_no',
|
||||
'intake_year',
|
||||
'intake_month',
|
||||
'village_name',
|
||||
'full_address',
|
||||
'preffered_location',
|
||||
'intrested_for_country',
|
||||
'intrested_course',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function admission(){
|
||||
return $this->belongsTo(Admission::class,'id','student_id');
|
||||
}
|
||||
|
||||
public function educations()
|
||||
{
|
||||
return $this->hasMany(StudentEducation::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function languages()
|
||||
{
|
||||
return $this->hasMany(StudentLanguage::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function fields()
|
||||
{
|
||||
return $this->hasMany(StudentField::class,'student_id','id');
|
||||
}
|
||||
|
||||
public function agent(){
|
||||
return $this->belongsTo(Agent::class,'ref_id','id');
|
||||
}
|
||||
|
||||
public function location(){
|
||||
return $this->belongsTo(Location::class,'ref_id','id');
|
||||
}
|
||||
|
||||
public function student_country(){
|
||||
return $this->belongsTo(Country::class,'country_id','id');
|
||||
}
|
||||
|
||||
public function student_state(){
|
||||
return $this->belongsTo(State::class,'state_id','id');
|
||||
}
|
||||
|
||||
public function student_district(){
|
||||
return $this->belongsTo(District::class,'district_id','id');
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentEducation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_student_education';
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'level',
|
||||
'university',
|
||||
'percentage',
|
||||
'documents',
|
||||
];
|
||||
|
||||
public static function getStudents()
|
||||
{
|
||||
// $records = DB::table('candidates')->select('id','first_name','middle_name','last_name','gender','material_status','spouse_name','father_name','mother_name','mobile_no','alternate_mobile_no','email','dob','full_address','status','is_active')->get()->toArray();
|
||||
$records = DB::table('candidates')
|
||||
->join('candidate_passports','candidate_passports.candidate_id','candidates.id')
|
||||
->join('countries','countries.id','candidates.country_id')
|
||||
->join('provinces','provinces.id','candidates.province_id')
|
||||
->join('districts','districts.id','candidates.district_id')
|
||||
->join('districts AS cid','cid.id','candidate_passports.citizenship_issue_district')
|
||||
->select('candidates.id','candidates.first_name','candidates.middle_name','candidates.last_name','candidates.gender','candidates.spouse_name','candidates.father_name','candidates.mother_name','candidates.mobile_no','candidates.alternate_mobile_no','candidates.email','candidates.dob','countries.country_name','provinces.province_name','districts.district_name','candidates.municipality_name','candidates.ward_no','candidates.full_address','candidate_passports.passport_number','candidate_passports.passport_issue_date','candidate_passports.passport_expiry_date','candidate_passports.citizenship_number','candidate_passports.citizenship_issue_date','cid.district_name AS cid_name')
|
||||
->get()
|
||||
->toArray();
|
||||
return $records;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentField extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'name',
|
||||
];
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\Student;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudentLanguage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_student_languages';
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'language',
|
||||
'score',
|
||||
'language_documents',
|
||||
];
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Models\TestPreparation;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TestPreparation extends Model
|
||||
{
|
||||
protected $table = 'tbl_testpreparations';
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'status',
|
||||
];
|
||||
}
|
@ -22,6 +22,7 @@ class User extends Authenticatable
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'employee_id',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
@ -43,4 +44,8 @@ class User extends Authenticatable
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
// public function employee(){
|
||||
// return $this->belongsTo(Employee::class,'employee_id');
|
||||
// }
|
||||
}
|
||||
|
@ -35,22 +35,23 @@
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link" href="{{ route('employee.index') }}">
|
||||
<a class="nav-link menu-link {{ \Request::is('employee') || (\Request::is('employee/*') ? 'active' : '') }}"
|
||||
href="{{ route('employee.index') }}">
|
||||
<i class="ri-team-line"></i> <span data-key="t-widgets">Employee</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link" href="{{ route('leave.index') }}">
|
||||
<a class="nav-link" href="{{ route('leave.index') }}">
|
||||
<i class="ri-honour-line"></i> <span data-key="t-widgets">Leave</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
{{-- <li class="nav-item">
|
||||
<a class="nav-link menu-link" href="{{ route('user.index') }}">
|
||||
<i class="ri-user-line"></i>User
|
||||
</a>
|
||||
</li>
|
||||
</li> --}}
|
||||
|
||||
|
||||
|
||||
@ -62,6 +63,15 @@
|
||||
<div class="menu-dropdown collapse" id="MenuTwo">
|
||||
<ul class="nav nav-sm flex-column">
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('user.index') }}"
|
||||
class="nav-link @if (\Request::is('user/*')) active @endif">Users</a>
|
||||
</li>
|
||||
|
||||
{{-- <li class="nav-item">
|
||||
<a href="{{ route('role.index') }}" class="nav-link">Roles</a>
|
||||
</li> --}}
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('countries.index') }}" class="nav-link">Countries</a>
|
||||
</li>
|
||||
|
@ -1,67 +0,0 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h1>Create User</h1>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<h5>Add New User</h5>
|
||||
<a href="{{ route('users.index') }}" class="btn btn-primary btn-sm">Back</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('users.store') }}" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="name">Name <span class="text-danger">*</span></label>
|
||||
<input id="name" class="form-control rounded-md" type="text" name="name" required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="email">Email <span class="text-danger">*</span></label>
|
||||
<input id="email" class="form-control rounded-md" type="text" name="email" required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="password">Password <span class="text-danger">*</span></label>
|
||||
<input id="password" class="form-control rounded-md" type="password" name="password" required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="role_id">Role<span class="text-danger">*</span></label>
|
||||
<select class="form-control rounded-md" name="role">
|
||||
@foreach ($roles as $role)
|
||||
<option value="{{ $role->id }}">{{ $role->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 d-flex justify-end">
|
||||
<button type="submit" class="btn btn-primary">Save Record</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
@ -1,55 +0,0 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h1>List users</h1>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-end p-3">
|
||||
@can('create users')
|
||||
<a href="{{ route('users.create') }}" class="btn btn-primary btn-sm">New User</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table-bordered table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border-1 border">S.N</th>
|
||||
<th class="border-1 border">Name</th>
|
||||
<th class="border-1 border">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@can('access users')
|
||||
@foreach ($users as $permission)
|
||||
<tr>
|
||||
<td>{{ $permission->id }}</td>
|
||||
<td>{{ $permission->name }}</td>
|
||||
<td>
|
||||
@can('edit users')
|
||||
<a href="{{ route('users.edit', $permission->id) }}"
|
||||
class="btn btn-primary btn-sm rounded-lg text-white"><i class="fas fa-edit"></i></a>
|
||||
@endcan
|
||||
@can('delete users')
|
||||
<form action="{{ route('users.destroy', $permission->id) }}" method="post">
|
||||
@csrf
|
||||
@method('delete')
|
||||
<a href="{{ route('users.destroy', $permission->id) }}"
|
||||
class="btn btn-danger btn-sm rounded-lg text-white"
|
||||
onclick="event.preventDefault();this.closest('form').submit();"><i
|
||||
class="fas fa-trash-alt"></i></a>
|
||||
</form>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endcan
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
@ -26,7 +26,6 @@ Route::get('/dashboard', [App\Http\Controllers\HomeController::class, 'index'])-
|
||||
|
||||
Route::resource('roles', RoleController::class)->names('roles');
|
||||
Route::resource('permissions', PermissionController::class)->names('permissions');
|
||||
Route::resource('users', UserController::class)->names('users');
|
||||
|
||||
Route::get('/initialize-db', function () {
|
||||
OMIS::initDB();
|
||||
|
Loading…
Reference in New Issue
Block a user