diff --git a/app/Console/Commands/GeneratePermissions.php b/app/Console/Commands/GeneratePermissions.php
new file mode 100644
index 0000000..48e2351
--- /dev/null
+++ b/app/Console/Commands/GeneratePermissions.php
@@ -0,0 +1,34 @@
+info('Generating Permissions');
+ PermissionRepository::generatePermissionFromRoutes();
+ $this->info('Permissions generated successfully!');
+ }
+}
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index e6b9960..599258a 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
+ // $this->load(__DIR__.'/Commands/GeneratePermissions.php');
require base_path('routes/console.php');
}
diff --git a/app/Helpers/CCMS.php b/app/Helpers/CCMS.php
index 981f784..48b74b7 100644
--- a/app/Helpers/CCMS.php
+++ b/app/Helpers/CCMS.php
@@ -33,23 +33,213 @@ class CCMS
first())) {
- // DB::statement("INSERT INTO `tbl_users` (`name`,`email`,`username`,`password`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1');");
- // }
- // if (!(DB::table('settings')->first())) {
- // DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) values ('Bibhuti LMS', '', '1');");
- // }
- // if (!(DB::table('articles')->first())) {
- // DB::statement("INSERT INTO `tbl_articles` (`title`,`alias`, `text`, `status`) VALUES ('Company Profile', 'company-profile','Welcome Article', '1');");
- // }
-
- // $initialized = true;
+ function getRouteList()
+ {
+ $routes = Route::getRoutes();
+ $ignoreRoutes = ['debugbar', 'login', 'register', 'logout', 'post', 'sanctum', 'ignition', 'unisharp', 'errorpage', 'form7', 'master', 'hr', 'setting', 'nepalidictonary', 'api'];
+ $routeNameArr = [];
+ foreach ($routes as $value) {
+ if (!is_null($value)) {
+ $routeName = explode('.', $value->getName());
+ if (is_array($routeName) && !empty($routeName[0])) {
+ if (!in_array($routeName[0], $ignoreRoutes)) {
+ $routeNameArr[$routeName[0]][] = $value->getName();
+ }
+ }
+ }
+ }
+ return $routeNameArr;
+ }
+
+ function generateEstimateNumber()
+ {
+ $lastEstimate = Estimate::withTrashed()->latest()->first();
+
+ if ($lastEstimate) {
+ $newEstimateNumber = intval($lastEstimate->id) + 1;
+ return 'EST-' . activeFiscalYear('code') . '-' . str_pad($newEstimateNumber, 4, '0', STR_PAD_LEFT);
+
+ } else {
+ return 'EST-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+
+ function generateCreditNoteNumber()
+ {
+ $lastCreditNote = CreditNote::withTrashed()->latest()->first();
+
+ if ($lastCreditNote) {
+ $newCreditNoteNumber = intval($lastCreditNote->id) + 1;
+ return 'CN-' . activeFiscalYear('code') . '-' . str_pad($newCreditNoteNumber, 4, '0', STR_PAD_LEFT);
+ } else {
+ return 'CN-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+
+ function generateInvoiceNumber()
+ {
+ $lastInvoice = Invoice::withTrashed()->latest()->first();
+
+ if ($lastInvoice) {
+ $newInvoiceNumber = intval($lastInvoice->id) + 1;
+ return 'INV-' . activeFiscalYear('code') . '-' . str_pad($newInvoiceNumber, 4, '0', STR_PAD_LEFT);
+ } else {
+ return 'INV-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+
+ function generateReceivedInvoiceNumber()
+ {
+ $lastReceivedInvoice = ReceivedInvoice::withTrashed()->latest()->first();
+
+ if ($lastReceivedInvoice) {
+ $newReceivedInvoiceNumber = intval($lastReceivedInvoice->id) + 1;
+ return 'RI-' . activeFiscalYear('code') . '-' . str_pad($newReceivedInvoiceNumber, 4, '0', STR_PAD_LEFT);
+ } else {
+ return 'RI-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+
+ function generateCashReceivedNumber()
+ {
+ $lastCastReceived = CashReceived::withTrashed()->latest()->first();
+
+ if ($lastCastReceived) {
+ $newCastReceivedNumber = intval($lastCastReceived->id) + 1;
+ return 'CR-' . activeFiscalYear('code') . '-' . str_pad($newCastReceivedNumber, 4, '0', STR_PAD_LEFT);
+ } else {
+ return 'CR-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+ function generateDebitNoteNumber()
+ {
+ $lastDebitNote = DebitNote::withTrashed()->latest()->first();
+
+ if ($lastDebitNote) {
+ $newDebitNoteNumber = intval($lastDebitNote->id) + 1;
+ return 'CR-' . activeFiscalYear('code') . '-' . str_pad($newDebitNoteNumber, 4, '0', STR_PAD_LEFT);
+ } else {
+ return 'CR-' . activeFiscalYear('code') . '-' . str_pad(1, 4, '0', STR_PAD_LEFT);
+ }
+ }
+}
+ // if (!function_exists('sendNotification')) {
+ // function sendNotification($user, $notification = [])
+ // {
+ // \Notification::send($user, new SendNotification($notification));
// }
// }
-}
+
+ if (!function_exists('uploadImage')) {
+ function uploadImage($file)
+ {
+ $fileName = time() . '_' . $file->getClientOriginalName();
+ $filePath = Storage::disk('public')->putFileAs('uploads', $file, $fileName);
+ return $filePath;
+ }
+ }
+
+ if (!function_exists('activeFiscalYear')) {
+ function activeFiscalYear($select)
+ {
+ $fiscalYearModel = FiscalYear::whereStatus(11)->first();
+ return $fiscalYearModel->$select ?? null;
+
+ }
+ }
+
+ if (!function_exists('setting')) {
+ function setting($key = '')
+ {
+ // Cache::forget('setting');
+ $setting = Cache::has('setting') ? Cache::get('setting') : Cache::rememberForever('setting', function () {
+ return Setting::get()->mapWithKeys(function ($setting) {
+ return [$setting->key => $setting->value];
+ });;
+ });
+ return $setting->has($key) ? $setting[$key] : null;
+ }
+ }
+
+ function convertAmountInWords($amount): string
+ {
+ $units = [
+ 'kharab' => 100000000000,
+ 'arab' => 1000000000,
+ 'crore' => 10000000,
+ 'lakh' => 100000,
+ 'thousand' => 1000,
+ 'hundred' => 100,
+ ];
+
+ $words = [];
+
+ foreach ($units as $unit => $value) {
+ if ($amount >= $value) {
+ $count = floor($amount / $value);
+ $remaining = $amount % $value;
+ $words[] = convertCount($count) . ' ' . $unit;
+ $amount = $remaining;
+ }
+ }
+
+ if ($amount > 0) {
+ $words[] = convertCount($amount);
+ }
+
+ return implode(' ', $words) . ' only /-';
+ }
+
+ function convertCount($count)
+ {
+ $ones = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
+ $teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
+ $tens = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
+
+ $words = [];
+
+ if ($count >= 100) {
+ $words[] = $ones[floor($count / 100)] . ' hundred';
+ $count %= 100;
+ if ($count > 0) {
+ $words[] = 'and';
+ }
+ }
+
+ if ($count >= 20) {
+ $tensPlace = $tens[floor($count / 10) - 2];
+ $onesPlace = $count % 10;
+ if ($onesPlace > 0) {
+ $words[] = $tensPlace . '-' . $ones[$onesPlace];
+ } else {
+ $words[] = $tensPlace;
+ }
+ } elseif ($count >= 10) {
+ $words[] = $teens[$count - 10];
+ } elseif ($count > 0) {
+ $words[] = $ones[$count];
+ }
+
+ return implode(' ', $words);
+ }
+
+ function getAllKeys($data)
+ {
+ $keys = [];
+
+ foreach ($data as $item) {
+ if (is_object($item)) {
+ $item = (array) $item;
+ }
+
+ if (is_array($item)) {
+ $subKeys = getAllKeys($item);
+ $keys = array_merge($keys, $subKeys);
+ } else {
+ $keys[] = $item;
+ }
+ }
+
+ return array_unique($keys);
+ }
diff --git a/app/Http/Controllers/Auth/AuthenticationController.php b/app/Http/Controllers/Auth/AuthenticationController.php
index 1db03b9..258b537 100644
--- a/app/Http/Controllers/Auth/AuthenticationController.php
+++ b/app/Http/Controllers/Auth/AuthenticationController.php
@@ -49,7 +49,7 @@ class AuthenticationController extends Controller
'phone' => ['required', 'integer'],
]);
- User::create([
+ $user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => bcrypt($request->password),
@@ -59,6 +59,7 @@ class AuthenticationController extends Controller
'email_verified_at' => now()
])->assignRole('user');
+ dd($user);
return response()->json(['success' => true, 'message' => 'User created successfully!', 'redirect_url' => route('userLogin')]);
}
diff --git a/app/Http/Controllers/CommentsController.php b/app/Http/Controllers/CommentsController.php
new file mode 100644
index 0000000..21b3103
--- /dev/null
+++ b/app/Http/Controllers/CommentsController.php
@@ -0,0 +1,171 @@
+modelService = new CommonModelService($model);
+ $this->commentRepository = $commentRepository;
+ }
+ public function index(Request $request)
+ {
+ createActivityLog(CommentsController::class, 'index', ' Comments index');
+ $data = Comments::where('status','<>',-1)->orderBy('created_at')->get();
+
+ return view("crud.generated.comments.index", compact('data'));
+ }
+
+ public function create(Request $request)
+ {
+ createActivityLog(CommentsController::class, 'create', ' Comments create');
+ $TableData = Comments::where('status','<>',-1)->orderBy('created_at')->get();
+ return view("crud.generated.comments.create",compact('TableData'));
+ }
+
+ public function store(Request $request)
+ {
+ createActivityLog(CommentsController::class, 'store', ' Comments store');
+ $validator = Validator::make($request->all(), [
+ //ADD REQUIRED FIELDS FOR VALIDATION
+ ]);
+
+ if ($validator->fails()) {
+ return response()->json([
+ 'error' => $validator->errors(),
+ ],500);
+ }
+
+ $requestData=$request->all();
+ array_walk_recursive($requestData, function (&$value) {
+ $value = str_replace(env('APP_URL').'/', '', $value);
+ });
+ array_walk_recursive($requestData, function (&$value) {
+ $value = str_replace(env('APP_URL'), '', $value);
+ });
+ $this->commentRepository->create($requestData);
+
+ if ($request->ajax()) {
+ return response()->json(['status' => true, 'message' => 'The Comments Created Successfully.'], 200);
+ }
+ return redirect()->route('comments.index')->with('success','The Comments created Successfully.');
+ }
+
+ public function sort(Request $request)
+ {
+ $idOrder = $request->input('id_order');
+
+ foreach ($idOrder as $index => $id) {
+ $companyArticle = Comments::find($id);
+ $companyArticle->display_order = $index + 1;
+ $companyArticle->save();
+ }
+
+ return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
+ }
+ public function updatealias(Request $request)
+ {
+
+ $articleId = $request->input('articleId');
+ $newAlias = $request->input('newAlias');
+ $companyArticle = Comments::find($articleId);
+ if (!$companyArticle) {
+ return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
+ }
+ $companyArticle->alias = $newAlias;
+ $companyArticle->save();
+ return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
+ }
+
+
+
+
+ public function show(Request $request, $id)
+ {
+ createActivityLog(CommentsController::class, 'show', ' Comments show');
+ $data = Comments::findOrFail($id);
+
+ return view("crud.generated.comments.show", compact('data'));
+ }
+
+
+ public function edit(Request $request, $id)
+ {
+ createActivityLog(CommentsController::class, 'edit', ' Comments edit');
+ $TableData = Comments::where('status','<>',-1)->orderBy('created_at')->get();
+ $data = Comments::findOrFail($id);
+ if ($request->ajax()) {
+ $html = view("crud.generated.comments.ajax.edit", compact('data'))->render();
+ return response()->json(['status' => true, 'content' => $html], 200);
+ }
+ return view("crud.generated.comments.edit", compact('data','TableData'));
+ }
+
+
+ public function update(Request $request, $id)
+ {
+ createActivityLog(CommentsController::class, 'update', ' Comments update');
+ $validator = Validator::make($request->all(), [
+ //ADD VALIDATION FOR REQIRED FIELDS
+ ]);
+
+ if ($validator->fails()) {
+ return response()->json([
+ 'error' => $validator->errors(),
+ ],500);
+ }
+ $filterData=$request->except(['_method','_token']);
+ array_walk_recursive($filterData, function (&$value) {
+ $value = str_replace(env('APP_URL').'/', '', $value);
+ });
+ array_walk_recursive($filterData, function (&$value) {
+ $value = str_replace(env('APP_URL'), '', $value);
+ });
+ $this->commentRepository->update($id, $filterData);
+ if ($request->ajax()) {
+ return response()->json(['status' => true, 'message' => 'The Comments updated Successfully.'], 200);
+ }
+ // return redirect()->route('comments.index')->with('success','The Comments updated Successfully.');
+ return redirect()->back()->with('success', 'The Comments updated successfully.');
+ }
+
+ public function destroy(Request $request,$id)
+ {
+ // dd($id);
+ $this->commentRepository->delete($id);
+ return response()->json(['status'=>true,'message'=>'The Comments Deleted Successfully.'],200);
+ }
+ public function toggle(Request $request,$id)
+ {
+ createActivityLog(CommentsController::class, 'destroy', ' Comments destroy');
+ $data = Comments::findOrFail($id);
+ $requestData=['status'=>($data->status==1)?0:1];
+ DB::beginTransaction();
+ try {
+ $OperationNumber = getOperationNumber();
+ $this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::info($e->getMessage());
+ createErrorLog(CommentsController::class, 'destroy', $e->getMessage());
+ return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
+ }
+ DB::commit();
+ return response()->json(['status'=>true,'message'=>'The Comments Deleted Successfully.'],200);
+ }
+
+
+
+ }
+
\ No newline at end of file
diff --git a/app/Http/Controllers/PermissionsController.php b/app/Http/Controllers/PermissionsController.php
index 3ed9e14..ba2cbc9 100644
--- a/app/Http/Controllers/PermissionsController.php
+++ b/app/Http/Controllers/PermissionsController.php
@@ -3,148 +3,104 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
+use App\Repositories\RoleRepository;
use Illuminate\Http\Request;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Validator;
-use App\Service\CommonModelService;
use Spatie\Permission\Models\Permission;
-use Spatie\Permission\Models\Role;
-use Log;
-use Exception;
+use App\Repositories\PermissionRepository;
+
class PermissionsController extends Controller
{
- protected $modelService;
- public function __construct(Permission $model)
- {
- $this->modelService = new CommonModelService($model);
- }
- public function index(Request $request)
- {
- createActivityLog(PermissionsController::class, 'index', ' Permissions index');
- $data = Permission::get();
+ private $permissionRepository;
+ private $role;
- return view("crud.generated.permissions.index", compact('data'));
+ public function __construct(permissionRepository $permissionRepository,
+ RoleRepository $role)
+ {
+ $this->permissionRepository = $permissionRepository;
+ $this->role = $role;
+ }
+ /**
+ * Display a listing of the resource.
+ */
+ public function index()
+ {
+ $data['title'] = 'Permission Lists';
+ $data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
+ $data['roles'] = $this->role->pluck();
+ $data['editable'] = false;
+ return view('crud.generated.permissions.index', $data);
}
- public function create(Request $request)
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create()
{
- createActivityLog(PermissionsController::class, 'create', ' Permissions create');
- $TableData = Permission::get();
- return view("crud.generated.permissions.create", compact('TableData'));
+ $data['editable'] = false;
+ $data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
+ return view('user::role.create', $data);
+
}
+ /**
+ * Store a newly created resource in storage.
+ */
public function store(Request $request)
{
- $validated = $request->validate([
- 'name' => 'required|max:255',
- ]);
- Permission::create($validated);
-
- if ($request->ajax()) {
- return response()->json(['status' => true, 'message' => 'The Permissions Created Successfully.'], 200);
- }
- return redirect()->route('permissions.index')->with('success', 'The Permissions created Successfully.');
}
- public function sort(Request $request)
- {
- $idOrder = $request->input('id_order');
-
- foreach ($idOrder as $index => $id) {
- $companyArticle = Permission::find($id);
- $companyArticle->display_order = $index + 1;
- $companyArticle->save();
- }
-
- return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
- }
- public function updatealias(Request $request)
+ /**
+ * Display the specified resource.
+ */
+ public function show(string $id)
{
- $articleId = $request->input('articleId');
- $newAlias = $request->input('newAlias');
- $companyArticle = Permission::find($articleId);
- if (!$companyArticle) {
- return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
- }
- $companyArticle->alias = $newAlias;
- $companyArticle->save();
- return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
-
-
-
- public function show(Request $request, $id)
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit(Permission $permission)
{
- createActivityLog(PermissionsController::class, 'show', ' Permissions show');
- $data = Permission::findOrFail($id);
-
- return view("crud.generated.permissions.show", compact('data'));
+ $data['title'] = "Edit Role";
+ $data['editable'] = true;
+ $data['role'] = $this->role->getRoleById($id);
+ $data['permissionIDsArray'] = $data['role']?->permissions?->pluck('id')->toArray();
+ $data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
+ return view('user::role.edit', $data);
}
-
- public function edit(Request $request, $id)
- {
- createActivityLog(PermissionsController::class, 'edit', ' Permissions edit');
- $TableData = Permission::get();
- $data = Permission::findOrFail($id);
- if ($request->ajax()) {
- $html = view("crud.generated.permissions.ajax.edit", compact('data'))->render();
- return response()->json(['status' => true, 'content' => $html], 200);
- }
- return view("crud.generated.permissions.edit", compact('data', 'TableData'));
- }
-
-
+ /**
+ * Update the specified resource in storage.
+ */
public function update(Request $request, Permission $permission)
{
-
- $validated = $request->validate(['name' => 'required']);
-
- $permission->update($validated);
-
- if ($request->ajax()) {
- return response()->json(['status' => true, 'message' => 'The Permissions updated Successfully.'], 200);
- }
- // return redirect()->route('permissions.index')->with('success','The Permissions updated Successfully.');
- return redirect()->route('permissions.index')->with('success', 'The Permissions updated successfully.');
+ //
}
- public function destroy(Request $request, $id)
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy($id)
{
- createActivityLog(PermissionsController::class, 'destroy', ' Permissions destroy');
- DB::beginTransaction();
- try {
- $OperationNumber = getOperationNumber();
- $this->modelService->destroy($OperationNumber, $OperationNumber, $id);
- } catch (Exception $e) {
- DB::rollBack();
- Log::info($e->getMessage());
- createErrorLog(PermissionsController::class, 'destroy', $e->getMessage());
- return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
- }
- DB::commit();
- return response()->json(['status' => true, 'message' => 'The Permissions Deleted Successfully.'], 200);
+ $permissionDelete = $this->permissionRepository->getPermissionById($id);
+
+ $permissionDelete->delete();
+ return response()->json(['status' => true, 'message' => 'Permission has been deleted'] );
}
- public function toggle(Request $request, $id)
+
+ public function generatePermissionFromRoutes()
{
- createActivityLog(PermissionsController::class, 'destroy', ' Permissions destroy');
- $data = Permission::findOrFail($id);
- $requestData = ['status' => ($data->status == 1) ? 0 : 1];
- DB::beginTransaction();
try {
- $OperationNumber = getOperationNumber();
- $this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
- } catch (Exception $e) {
- DB::rollBack();
- Log::info($e->getMessage());
- createErrorLog(PermissionsController::class, 'destroy', $e->getMessage());
- return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
+ $this->permissionRepository->generatePermissionFromRoutes();
+ toastr()->success('Permission generated successfully!');
+ } catch (\Throwable $th) {
+ toastr()->error($th->getMessage());
+
}
- DB::commit();
- return response()->json(['status' => true, 'message' => 'The Permissions Deleted Successfully.'], 200);
+ return to_route('permissions.index');
+
}
}
diff --git a/app/Http/Controllers/RolesController.php b/app/Http/Controllers/RolesController.php
index 50d8f03..e9e1281 100644
--- a/app/Http/Controllers/RolesController.php
+++ b/app/Http/Controllers/RolesController.php
@@ -3,123 +3,101 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
+use App\Repositories\PermissionRepository;
use Illuminate\Http\Request;
use App\Models\Roles;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Validator;
-use App\Service\CommonModelService;
-use Spatie\Permission\Models\Role;
-use Spatie\Permission\Models\Permission;
+use Illuminate\Http\RedirectResponse;
+use Brian2694\Toastr\Facades\Toastr;
+use App\Repositories\RoleRepository;
use Log;
use Exception;
class RolesController extends Controller
{
- protected $modelService;
- public function __construct(Roles $model)
- {
- $this->modelService = new CommonModelService($model);
+ private $roleRepository;
+ private $permissionRepository;
+ public function __construct(
+ RoleRepository $roleRepository,
+ PermissionRepository $permissionRepository
+ ) {
+ $this->roleRepository = $roleRepository;
+ $this->permissionRepository = $permissionRepository;
}
+
public function index(Request $request)
{
+ $data['title'] = "List Roles";
createActivityLog(RolesController::class, 'index', ' Roles index');
- $data = Role::whereNotIn('name', ['admin'])->get();
+ $roles = $this->roleRepository->findAll();
- return view("crud.generated.roles.index", compact('data'));
+ return view("crud.generated.roles.index", compact('roles'));
}
- public function create(Request $request)
+ public function create()
{
- createActivityLog(RolesController::class, 'create', ' Roles create');
- $TableData = Roles::get();
- $permissions = Permission::all();
- return view("crud.generated.roles.create", compact('TableData', 'permissions'));
+ $data['title'] = "Create Role";
+ $data['editable'] = false;
+ $data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
+ return view('crud.generated.roles.create', $data);
}
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
- $validated = $request->validate(['name' => ['required', 'min:3']]);
- $role = Role::create($validated);
+ try {
- if ($role->hasPermissionTo($request->permission, 'web')) {
- return back()->with('message', 'Permission exists.');
+ $validatedData = $request->validate([
+ 'name' => 'required',
+ 'guard_name' => 'string',
+ ]);
+
+ $role = $this->roleRepository->create($validatedData);
+
+ $role->permissions()->attach($request->permissions);
+
+ Toastr::success('New Role has been created', 'Title', ["positionClass" => "toast-top-center"]);
+ } catch (\Throwable $th) {
+ Toastr::success('Error while creating', 'Title', ["positionClass" => "toast-top-center"]);
}
- $role->givePermissionTo($request->permission);
-
- if ($request->ajax()) {
- return response()->json(['status' => true, 'message' => 'The Roles Created Successfully.'], 200);
- }
- return redirect()->route('roles.index')->with('success', 'The Roles created Successfully.');
+ return redirect()->route('roles.index');
}
-
- public function sort(Request $request)
+ public function show(string $id)
{
- $idOrder = $request->input('id_order');
-
- foreach ($idOrder as $index => $id) {
- $companyArticle = Roles::find($id);
- $companyArticle->display_order = $index + 1;
- $companyArticle->save();
- }
-
- return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
+ //
}
-
-
- public function show(Request $request, $id)
+ public function edit($id)
{
- createActivityLog(RolesController::class, 'show', ' Roles show');
- $data = Roles::findOrFail($id);
-
- return view("crud.generated.roles.show", compact('data'));
+ $data['title'] = "Edit Role";
+ $data['editable'] = false;
+ $data['role'] = $this->roleRepository->getRoleById($id);
+ $data['permissionIDsArray'] = $data['role']?->permissions?->pluck('id')->toArray();
+ $data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
+ return view('crud.generated.roles.edit', $data);
}
-
- public function edit(Request $request, $id)
+ public function update(Request $request, $id): RedirectResponse
{
- createActivityLog(RolesController::class, 'edit', ' Roles edit');
- $permissions = Permission::all();
- $TableData = Role::get();
- $data = Role::findOrFail($id);
- if ($request->ajax()) {
- $html = view("crud.generated.roles.ajax.edit", compact('data'))->render();
- return response()->json(['status' => true, 'content' => $html], 200);
+ try {
+ $validatedData = $request->validate([
+ 'name' => 'required',
+ 'guard_name' => 'string',
+ ]);
+
+ $role = $this->roleRepository->update($id, $validatedData);
+ $role->permissions()->sync($request->permissions);
+
+ Toastr::success('Role has been updated', 'Title', ["positionClass" => "toast-top-center"]);
+ } catch (\Throwable $th) {
+ Toastr::success('Error while updating', 'Title', ["positionClass" => "toast-top-center"]);
}
- return view("crud.generated.roles.edit", compact('data', 'TableData', 'permissions'));
+ return redirect()->route('roles.index');
}
-
- public function update(Request $request, Role $role)
+ public function destroy($id)
{
- $permission = $request->permission;
- $validated = $request->validate(['name' => ['required', 'min:3']]);
- $role->update($validated);
-
- if($permission){
- $role->givePermissionTo($permission);
- }
-
- if ($request->ajax()) {
- return response()->json(['status' => true, 'message' => 'The Roles updated Successfully.'], 200);
- }
- // return redirect()->route('roles.index')->with('success','The Roles updated Successfully.');
- return redirect()->back()->with('success', 'The Roles updated successfully.');
- }
-
- public function destroy(Role $role)
- {
- $role->delete();
- return response()->json(['status' => true, 'message' => 'The Roles Deleted Successfully.'], 200);
- }
-
- public function revokePermission(Role $role, Permission $permission)
- {
- if ($role->hasPermissionTo($permission)) {
- $role->revokePermissionTo($permission);
- return back()->with('message', 'Permission revoked.');
- }
- return back()->with('message', 'Permission not exists.');
+ $this->roleRepository->delete($id);
+ Toastr::success('Role has been deleted', 'Title', ["positionClass" => "toast-top-center"]);
+ return response()->json(['status' => true, 'message' => 'Role has been deleted!']);
}
}
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index 67e7b2f..910e4a8 100644
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -3,115 +3,135 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
+use App\Repositories\RoleInterface;
+use App\Repositories\RoleRepository;
+use App\Repositories\UserRepository;
use Illuminate\Http\Request;
-use App\Models\User;
-use Illuminate\Support\Facades\DB;
-use Spatie\Permission\Models\Permission;
-use Spatie\Permission\Models\Role;
-use App\Service\CommonModelService;
-use Log;
-use Exception;
+use Illuminate\Http\RedirectResponse;
+use Brian2694\Toastr\Facades\Toastr;
class UsersController extends Controller
{
- protected $modelService;
+ protected $userRepository;
+ protected $employeeRepository;
+ protected $roleRepository;
- public function __construct(User $model)
+ public function __construct(UserRepository $userRepository, RoleRepository $roleRepository)
{
- $this->modelService = new CommonModelService($model);
+ $this->userRepository = $userRepository;
+ $this->roleRepository = $roleRepository;
}
- public function index(Request $request)
+ public function index()
{
- createActivityLog(UsersController::class, 'index', 'User index');
- $data = User::get();
- return view("crud.generated.users.index", compact('data'));
+ $data['users'] = $this->userRepository->findAll();
+ $data['editable'] = false;
+ $data['roleLists'] = $this->roleRepository->pluck();
+ return view('crud.generated.users.index', $data);
}
- public function show(Request $request, $id)
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create()
{
- createActivityLog(UsersController::class, 'show', 'User show');
- $data = User::findOrFail($id);
- return view("crud.generated.User.show", compact('data'));
+ $data['title'] = "Create User";
+ $data['editable'] = false;
+ $data['roleLists'] = $this->roleRepository->pluck();
+ return view('crud.generated.users.create', $data);
}
- public function edit(Request $request, $id)
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request): RedirectResponse
{
- createActivityLog(UsersController::class, 'edit', 'User edit');
- $TableData = User::get();
- $data = User::findOrFail($id);
- $roles = Role::all();
- $permissions = Permission::all();
+ // try {
- if ($request->ajax()) {
- $html = view("crud.generated.User.ajax.edit", compact('data'))->render();
- return response()->json(['status' => true, 'content' => $html], 200);
- }
+ $validated = $request->validate([
+ 'name' => 'required|min:5',
+ 'email' => 'required',
+ 'password' => 'required',
+ ]);
- return view("crud.generated.users.edit", compact('data', 'TableData', 'roles', 'permissions'));
+ $validated['password'] = bcrypt($validated['password']);
+
+ $this->userRepository->create($validated, $request->role);
+
+ Toastr::success('User has been created successfully.', 'Title', ["positionClass" => "toast-top-center"]);
+
+ // } catch (\Throwable $th) {
+
+ // echo $th->getMessage();
+
+ // toastr()->error($th->getMessage());
+
+ // }
+
+ return redirect()->route('user.index');
}
- public function update(Request $request, User $user)
+ /**
+ * Show the specified resource.
+ */
+
+ public function show($id)
{
- // dd($request->toArray());
-
- if ($request->permission) {
- if ($user->hasPermissionTo($request->permission)) {
- return redirect()->back()->with('error', 'The User already has this permission.');
- }
- $user->givePermissionTo($request->permission);
- }
- if ($request->role) {
- if ($user->hasRole($request->role)) {
- return redirect()->back()->with('error', 'The User already has this role.');
- }
- $user->assignRole($request->role);
- }
-
- if ($request->ajax()) {
- return response()->json(['status' => true, 'message' => 'The User updated Successfully.'], 200);
- }
-
- // Logic to update user should be added here
-
- return redirect()->back()->with('success', 'The User updated successfully.');
+ $data['user'] = $this->userRepository->getUserById($id);
+ return view('user::user.show');
}
- public function destroy(Request $request, $id)
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit($id)
{
- createActivityLog(UsersController::class, 'destroy', 'User destroy');
- DB::beginTransaction();
+ $data['title'] = "Edit User";
+ $data['editable'] = true;
+ $data['roleLists'] = $this->roleRepository->pluck();
+ $data['user'] = $this->userRepository->getUserById($id);
+ return view('crud.generated.users.edit', $data);
+ }
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, $id): RedirectResponse
+ {
try {
- $OperationNumber = getOperationNumber();
- $this->modelService->destroy($OperationNumber, $OperationNumber, $id);
- } catch (Exception $e) {
- DB::rollBack();
- Log::info($e->getMessage());
- createErrorLog(UsersController::class, 'destroy', $e->getMessage());
- return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
+
+ $validated = $request->validate([
+ 'name' => 'required|min:5',
+ 'email' => 'required',
+ 'password' => 'required',
+ ]);
+
+ $validated['password'] = bcrypt($validated['password']);
+
+ $this->userRepository->update($id, $validated, $request->role);
+
+ Toastr::success('User has been updated', 'Title', ["positionClass" => "toast-top-center"]);
+ } catch (\Throwable $th) {
+
+ toastr()->error($th->getMessage());
}
- DB::commit();
- return response()->json(['status' => true, 'message' => 'The User Deleted Successfully.'], 200);
+ return redirect()->route('user.index');
}
- public function removeRole(User $user, Role $role)
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy($id)
{
- if ($user->hasRole($role)) {
- $user->removeRole($role);
- return back()->with('message', 'Role removed.');
- }
+ try {
- return back()->with('message', 'Role not exists.');
- }
+ $this->userRepository->delete($id);
- public function revokePermission(User $user, Permission $permission)
- {
- if ($user->hasPermissionTo($permission)) {
- $user->revokePermissionTo($permission);
- return back()->with('message', 'Permission revoked.');
+ Toastr::success('User has been deleted', 'Title', ["positionClass" => "toast-top-center"]);
+ } catch (\Throwable $th) {
+
+ Toastr::success('Error deleting user', 'Title', ["positionClass" => "toast-top-center"]);
}
- return back()->with('message', 'Permission does not exists.');
}
}
diff --git a/app/Http/Controllers/WebsiteController.php b/app/Http/Controllers/WebsiteController.php
index 611411e..d519afa 100644
--- a/app/Http/Controllers/WebsiteController.php
+++ b/app/Http/Controllers/WebsiteController.php
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Mail\sendEmail;
use App\Models\Advertisements;
use App\Models\Articles;
+use App\Models\Comments;
use App\Models\Economies;
use App\Models\Horoscopes;
use App\Models\Menuitems;
@@ -18,6 +19,7 @@ use App\Models\Teams;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Mail;
+use Illuminate\Support\Facades\Route;
use App\Models\Videos;
use Share;
@@ -27,6 +29,13 @@ class WebsiteController extends Controller
public function __construct()
{
+ $routes = Route::getRoutes();
+ // dd($routes);
+ // foreach ($routes as $route) {
+ // $name= $route->getName();
+ // dump($name);
+ // }
+ // dd('end');
$this->path = config('app.client_path');
$headerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 1])->with('children')->orderBy('display_order')->get();
@@ -36,6 +45,8 @@ class WebsiteController extends Controller
$ads = Advertisements::where('status', 1)->where('parent_advertisement', 0)->get();
$adsWithChildren = Advertisements::where('status', 1)->where('parent_advertisement', 0)->orderBy('display_order')->with('children')->get();
$popup = Popups::where('status',1)->latest()->first();
+ $route = Route::getRoutes();
+
View::share(
[
'headerMenuItems' => $headerMenuItems,
@@ -104,7 +115,8 @@ class WebsiteController extends Controller
$news->views_count = $news->views_count + 1;
$news->save();
-
+ $newsWithComment = News::with('comments')->where('news_id', $news->news_id)->get();
+ // dd($newsWithComment->toArray());
$recentNews = News::where('status', 1)
->where('news_id', '!=', $news->news_id)
->inRandomOrder()
@@ -112,7 +124,7 @@ class WebsiteController extends Controller
->latest()
->get();
- return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent'));
+ return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent','newsWithComment'));
}
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 6bd7139..c8eb4d9 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -36,6 +36,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
+ \App\Http\Middleware\PermissionMiddleware::class,
],
'api' => [
@@ -64,8 +65,8 @@ class Kernel extends HttpKernel
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
- 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
- 'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
- 'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
+ // 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
+ 'permission' => \App\Http\Middleware\PermissionMiddleware::class,
+ // 'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
];
}
diff --git a/app/Http/Middleware/PermissionMiddleware.php b/app/Http/Middleware/PermissionMiddleware.php
new file mode 100644
index 0000000..c99f199
--- /dev/null
+++ b/app/Http/Middleware/PermissionMiddleware.php
@@ -0,0 +1,62 @@
+user();
+
+ // For machine-to-machine Passport clients
+ if (!$user && $request->bearerToken() && config('permission.use_passport_client_credentials')) {
+
+ $user = Guard::getPassportClient($guard);
+ }
+
+ if (!$user) {
+
+ throw UnauthorizedException::notLoggedIn();
+ }
+
+ if (!method_exists($user, 'hasAnyPermission')) {
+
+ throw UnauthorizedException::missingTraitHasRoles($user);
+ }
+
+ // if ($user->hasRole('admin')) {
+ // return $next($request);
+ // }
+
+ foreach ($user->roles as $role) {
+ if ($role->hasPermissionTo($request->route()->getName())) {
+ return $next($request);
+ }
+ }
+
+ throw UnauthorizedException::forPermissions($user->getAllPermissions()->toArray());
+
+ }
+
+ /**
+ * Specify the permission and guard for the middleware.
+ *
+ * @param array|string $permission
+ * @param string|null $guard
+ * @return string
+ */
+ public static function using($permission, $guard = null)
+ {
+ $permissionString = is_string($permission) ? $permission : implode('|', $permission);
+ $args = is_null($guard) ? $permissionString : "$permissionString,$guard";
+
+ return static::class . ':' . $args;
+ }
+}
diff --git a/app/Models/Comments.php b/app/Models/Comments.php
new file mode 100644
index 0000000..9e7b612
--- /dev/null
+++ b/app/Models/Comments.php
@@ -0,0 +1,53 @@
+status == 1 ? ' Active ' : 'Inactive ';
+ }
+
+
+ public function news():BelongsTo{
+
+ return $this->belongsTo(News::class,'news_id','news_id');
+ }
+
+ public function parent(){
+ return $this->belongsTo(Comments::class,'parent_id');
+ }
+
+ public function subComments(){
+ return $this->hasMany(Comments::class,'parent_id');
+ }
+
+ public function user(){
+ return $this->belongsTo(User::class, 'users_id', 'id');
+ }
+
+}
diff --git a/app/Models/News.php b/app/Models/News.php
index ae92ef6..89c63eb 100644
--- a/app/Models/News.php
+++ b/app/Models/News.php
@@ -89,4 +89,12 @@ class News extends Model
public function provinces(): BelongsTo{
return $this->belongsTo(Provinces::class, 'provinces_id', 'province_id');
}
+
+ public function comments()
+ {
+ return $this->hasMany(Comments::class, 'news_id', 'news_id')->with('subcomments')
+ ->where('parent_id', 0)
+ ->orWhere('parent_id', null)
+ ->where('status', 1);
+ }
}
diff --git a/app/Models/User.php b/app/Models/User.php
index 85a42d5..42cec01 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -45,4 +45,8 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
+
+ public function comments(){
+ return $this->hasMany(Comments::class,'users_id','id');
+ }
}
diff --git a/app/Repositories/Interface/AdCategoriesInterface.php b/app/Repositories/AdCategoriesInterface.php
similarity index 80%
rename from app/Repositories/Interface/AdCategoriesInterface.php
rename to app/Repositories/AdCategoriesInterface.php
index ee2ca4b..313b14d 100644
--- a/app/Repositories/Interface/AdCategoriesInterface.php
+++ b/app/Repositories/AdCategoriesInterface.php
@@ -1,6 +1,6 @@
update($Details);
+ }
+
+ public function delete($commentId)
+ {
+ return Comments::where('id', $commentId)->delete();
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/Interface/EconomyInterface.php b/app/Repositories/EconomyInterface.php
similarity index 85%
rename from app/Repositories/Interface/EconomyInterface.php
rename to app/Repositories/EconomyInterface.php
index cdee956..f210ce7 100644
--- a/app/Repositories/Interface/EconomyInterface.php
+++ b/app/Repositories/EconomyInterface.php
@@ -1,6 +1,6 @@
findOrFail($roleId);
+ }
+
+ public function update($permissionId, array $newDetails)
+ {
+ return Permission::where('id', $permissionId)->update($newDetails);
+ }
+
+ public function getPermissionListsArrangedByPrefix()
+ {
+ $permissions = self::findAll();
+
+ $routeNameArr = [];
+ foreach ($permissions as $permission) {
+ if (!is_null($permission->name)) {
+ $routeName = explode('.', $permission->name);
+ if (is_array($routeName) && !empty($routeName[0])) {
+ $routeNameArr[$routeName[0]][$permission->id] = array_key_exists(1, $routeName) ? $routeName[1] : $routeName[0];
+ }
+ }
+ }
+ return $routeNameArr;
+ }
+
+ public static function generatePermissionFromRoutes()
+ {
+ $routes = Route::getRoutes();
+ // dd($routes);
+
+ foreach ($routes as $route) {
+
+ $routeName = $route->getName();
+
+ $ignoreRoutes = [
+ 'installer',
+ 'LaravelUpdater',
+ 'debugbar',
+ 'login',
+ 'register',
+ 'logout',
+ 'post',
+ 'ignition',
+ 'unisharp',
+ 'userLogin',
+ 'postLogin',
+ 'postLogin',
+ 'postresgistration',
+ 'home',
+ 'single',
+ 'newsDetail',
+ 'password',
+ 'showHororscope',
+ 'showInternational',
+ 'showVideos',
+ 'videoDetail',
+ 'showAboutus',
+ 'showArtilce',
+ 'showProvinces',
+ 'contact',
+ 'sendEmail',
+ 'verification',
+ 'auth',
+ 'upload',
+ 'sanctum',
+ 'ignition',
+ 'welcome',
+ 'home',
+ 'api'
+ ];
+
+ $routePrefix = explode('.', $routeName);
+
+ if (is_array($routePrefix) && !empty($routePrefix[0])) {
+ if (!in_array($routePrefix[0], $ignoreRoutes) && !Permission::where('name', $routeName)->exists()) {
+ Permission::create(['name' => $routeName, 'guard_name' => 'web']);
+ }
+ }
+ }
+
+ $roles = Role::all();
+ foreach ($roles as $role) {
+
+ if ($role->name == 'admin' || $role->name == 'editor') {
+ $role->givePermissionTo(Permission::all());
+ }
+ }
+ }
+}
diff --git a/app/Repositories/Interface/PopupInterface.php b/app/Repositories/PopupInterface.php
similarity index 78%
rename from app/Repositories/Interface/PopupInterface.php
rename to app/Repositories/PopupInterface.php
index 766ffb7..6adaccf 100644
--- a/app/Repositories/Interface/PopupInterface.php
+++ b/app/Repositories/PopupInterface.php
@@ -1,6 +1,6 @@
get();
+ }
+
+ public function getRoleById($roleId)
+ {
+ return Role::with('permissions')->findOrFail($roleId);
+ }
+
+ public function delete($roleId)
+ {
+ $role = self::getRoleById($roleId);
+ $role->permissions()->detach();
+ return $role->delete();
+ }
+
+ public function create(array $roleDetails)
+ {
+ return Role::create($roleDetails);
+ }
+
+ public function update($roleId, array $newDetails)
+ {
+ $role = Role::find($roleId);
+ $role->update($newDetails);
+ return $role;
+ }
+ public function getPermissionListsArrangedByPrefix()
+ {
+ $permissions = self::findAll();
+
+ $routeNameArr = [];
+ foreach ($permissions as $permission) {
+ if (!is_null($permission->name)) {
+ $routeName = explode('.', $permission->name);
+ if (is_array($routeName) && !empty($routeName[0])) {
+ $routeNameArr[$routeName[0]][$permission->id] = array_key_exists(1, $routeName) ? $routeName[1] : $routeName[0];
+ }
+ }
+ }
+ return $routeNameArr;
+ }
+}
diff --git a/app/Repositories/Interface/SettingInterface.php b/app/Repositories/SettingInterface.php
similarity index 79%
rename from app/Repositories/Interface/SettingInterface.php
rename to app/Repositories/SettingInterface.php
index a4bcd80..9af7502 100644
--- a/app/Repositories/Interface/SettingInterface.php
+++ b/app/Repositories/SettingInterface.php
@@ -1,6 +1,6 @@
roles()->attach($role);
+ return $user;
+ }
+
+ public function update($userId, array $newDetails, array $role)
+ {
+ $user = User::whereId($userId)->update($newDetails);
+ $user->roles()->sync($role);
+ return $user;
+ }
+
+ public function delete($userId)
+ {
+ $user = User::whereId($userId)->first();
+ $user->roles()->detach();
+ return $user->delete();
+ }
+}
diff --git a/app/Repositories/VideoRepository.php b/app/Repositories/VideoRepository.php
index 32187be..0675a8a 100644
--- a/app/Repositories/VideoRepository.php
+++ b/app/Repositories/VideoRepository.php
@@ -3,7 +3,7 @@
namespace App\Repositories;
use App\Models\Videos;
-use App\Repositories\Interface\VideosInterface;
+use App\Repositories\VideosInterface;
class VideoRepository implements VideosInterface
diff --git a/app/Repositories/Interface/VideosInterface.php b/app/Repositories/VideosInterface.php
similarity index 86%
rename from app/Repositories/Interface/VideosInterface.php
rename to app/Repositories/VideosInterface.php
index bb81068..22282cd 100644
--- a/app/Repositories/Interface/VideosInterface.php
+++ b/app/Repositories/VideosInterface.php
@@ -1,6 +1,6 @@
Facade::defaultAliases()->merge([
'Toastr' => Brian2694\Toastr\Facades\Toastr::class,
'Share' => Jorenvh\Share\ShareFacade::class,
+ 'Html' => Spatie\Html\Facades\Html::class,
])->toArray(),
];
diff --git a/config/toastr.php b/config/toastr.php
new file mode 100644
index 0000000..7bfd66d
--- /dev/null
+++ b/config/toastr.php
@@ -0,0 +1,21 @@
+ [
+ "closeButton" => false,
+ "debug" => false,
+ "newestOnTop" => false,
+ "progressBar" => false,
+ "positionClass" => "toast-top-right",
+ "preventDuplicates" => false,
+ "onclick" => null,
+ "showDuration" => "300",
+ "hideDuration" => "1000",
+ "timeOut" => "5000",
+ "extendedTimeOut" => "1000",
+ "showEasing" => "swing",
+ "hideEasing" => "linear",
+ "showMethod" => "fadeIn",
+ "hideMethod" => "fadeOut"
+ ],
+];
diff --git a/database/migrations/2024_06_23_042435_create_comments_table.php b/database/migrations/2024_06_23_042435_create_comments_table.php
new file mode 100644
index 0000000..7ac72a8
--- /dev/null
+++ b/database/migrations/2024_06_23_042435_create_comments_table.php
@@ -0,0 +1,32 @@
+id();
+ $table->integer('parent_id')->nullable();
+ $table->integer('users_id')->constrained();
+ $table->integer('news_id')->constrained();
+ $table->text('content');
+ $table->integer('status')->default(1);
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('comments');
+ }
+};
diff --git a/public/hulaki/assets/css/custom.css b/public/hulaki/assets/css/custom.css
new file mode 100644
index 0000000..40e3e9f
--- /dev/null
+++ b/public/hulaki/assets/css/custom.css
@@ -0,0 +1,141 @@
+@import url('https://fonts.googleapis.com/css?family=Roboto&display=swap');
+@import url('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
+
+* {
+ margin: 0;
+ padding: 0;
+}
+
+*,
+*::before,
+*::after {
+ margin: 0;
+ padding: 0;
+ box-sizing: inherit;
+}
+
+
+.cd__intro {
+ padding: 60px 30px;
+ margin-bottom: 15px;
+ flex-direction: column;
+
+}
+
+.cd__intro,
+.cd__credit {
+ display: flex;
+ width: 100%;
+ justify-content: center;
+ align-items: center;
+ background: #fff;
+ color: #333;
+ line-height: 1.5;
+ text-align: center;
+}
+
+.cd__intro h1 {
+ font-size: 18pt;
+ padding-bottom: 15px;
+
+}
+
+.cd__intro p {
+ font-size: 14px;
+}
+
+.cd__action {
+ text-align: center;
+ display: block;
+ margin-top: 20px;
+}
+
+.cd__action a.cd__btn {
+ text-decoration: none;
+ color: #666;
+ border: 2px solid #666;
+ padding: 10px 15px;
+ display: inline-block;
+ margin-left: 5px;
+}
+
+.cd__action a.cd__btn:hover {
+ background: #666;
+ color: #fff;
+ transition: .3s;
+ -webkit-transition: .3s;
+}
+
+.cd__action .cd__btn:before {
+ font-family: FontAwesome;
+ font-weight: normal;
+ margin-right: 10px;
+}
+
+.down:before {
+ content: "\f019"
+}
+
+.back:before {
+ content: "\f112"
+}
+
+.cd__credit {
+ padding: 12px;
+ font-size: 9pt;
+ margin-top: 40px;
+
+}
+
+.cd__credit span:before {
+ font-family: FontAwesome;
+ color: #e41b17;
+ content: "\f004";
+
+
+}
+
+.cd__credit a {
+ color: #333;
+ text-decoration: none;
+}
+
+.cd__credit a:hover {
+ color: #1DBF73;
+}
+
+.cd__credit a:hover:after {
+ font-family: FontAwesome;
+ content: "\f08e";
+ font-size: 9pt;
+ position: absolute;
+ margin: 3px;
+}
+
+.cd__main {
+ background: #fff;
+ padding: 20px;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: center;
+
+}
+
+.cd__main {
+ display: flex;
+ width: 100%;
+}
+
+@media only screen and (min-width: 1360px) {
+ .cd__main {
+ max-width: 1280px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 24px;
+ }
+}
+
+fieldset,
+legend {
+ all: revert;
+}
\ No newline at end of file
diff --git a/public/hulaki/assets/js/custom.js b/public/hulaki/assets/js/custom.js
index cccc00d..23e658a 100644
--- a/public/hulaki/assets/js/custom.js
+++ b/public/hulaki/assets/js/custom.js
@@ -1,194 +1,71 @@
-// marquee
-function handleMarquee() {
- const marquee = document.querySelectorAll('.marquee');
- let speed = 1;
- let lastScrollPos = 0;
- let timer;
+
- marquee.forEach(function (el) {
- // stop animation on mouseenter
- mouseEntered = false;
- document.querySelector('.inner').addEventListener('mouseenter', function () {
- mouseEntered = true;
- })
- document.querySelector('.inner').addEventListener('mouseleave', function () {
- mouseEntered = false
- })
- const container = el.querySelector('.inner');
- const content = el.querySelector('.inner > *');
- //Get total width
- const elWidth = content.offsetWidth;
-
- //Duplicate content
- let clone = content.cloneNode(true);
- container.appendChild(clone);
-
- let progress = 1;
-
- function loop() {
- if (mouseEntered === false) {
- progress = progress - speed;
- }
- if (progress <= elWidth * -1) {
- progress = 0;
- }
- container.style.transform = 'translateX(' + progress + 'px)';
- window.requestAnimationFrame(loop);
+$('body').on('click', '.remove-item', function (e) {
+ e.preventDefault();
+ let url = $(this).data('link');
+ let id = $(this).data('id');
+ 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({
+ url: url,
+ type: 'DELETE',
+ headers: {
+ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
+ },
+ data: {
+ id: id
+ },
+ success: function (response) {
+ location.reload();
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ }
+ });
}
- loop();
- });
-
- function handleSpeedClear() {
- speed = 4;
- }
- };
-
- handleMarquee();
-
- //DROPDOWN
-
- const $dropdown = $(".dropdown");
- const $dropdownToggle = $(".dropdown-toggle");
- const $dropdownMenu = $(".dropdown-menu");
- const showClass = "show";
-
- $(window).on("load resize", function () {
- if (this.matchMedia("(min-width: 768px)").matches) {
- $dropdown.hover(
- function () {
- const $this = $(this);
- $this.addClass(showClass);
- $this.find($dropdownToggle).attr("aria-expanded", "true");
- $this.find($dropdownMenu).addClass(showClass);
- },
- function () {
- const $this = $(this);
- $this.removeClass(showClass);
- $this.find($dropdownToggle).attr("aria-expanded", "false");
- $this.find($dropdownMenu).removeClass(showClass);
- }
- );
- } else {
- $dropdown.off("mouseenter mouseleave");
- }
});
- // SIDE NAV
- function openNav() {
- document.getElementById("mySidenav").style.width = "320px";
- }
-
- function closeNav() {
- document.getElementById("mySidenav").style.width = "0";
- }
- $(document).ready(function () {
- $('textarea#body').summernote({
- height: '300px'
- });
- });
- // SCROLL TO TOP
-
- mybutton = document.getElementById("myBtn");
- window.onscroll = function () {
- scrollFunction()
- };
- function scrollFunction() {
- if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
- mybutton.style.display = "block";
- } else {
- mybutton.style.display = "none";
- }
- }
-
- function topFunction() {
- document.body.scrollTop = 0;
- document.documentElement.scrollTop = 0;
- }
-
- //FOR SIDENAV DROPDOWN
- $(".feat-btn").click(function () {
- $("nav ul .feat-show").toggleClass("show");
- $("nav ul .first").toggleClass("rotate");
- });
- $(".samachar-btn").click(function () {
- $("nav ul .samachar-show").toggleClass("show1");
- $("nav ul .second").toggleClass("rotate");
- });
- $(".jeewan-btn").click(function () {
- $("nav ul .jeewan-show").toggleClass("show2");
- $("nav ul .third").toggleClass("rotate");
- });
- $(".artha-btn").click(function () {
- $("nav ul .artha-show").toggleClass("show3");
- $("nav ul .fourth").toggleClass("rotate");
- });
- $(".suchana-btn").click(function () {
- $("nav ul .suchana-show").toggleClass("show4");
- $("nav ul .fifth").toggleClass("rotate");
- });
- $(".khelkud-btn").click(function () {
- $("nav ul .khelkud-show").toggleClass("show5");
- $("nav ul .sixth").toggleClass("rotate");
- });
- $(".kala-btn").click(function () {
- $("nav ul .kala-show").toggleClass("show6");
- $("nav ul .seventh").toggleClass("rotate");
- });
- $(".bichar-btn").click(function () {
- $("nav ul .bichar-show").toggleClass("show7");
- $("nav ul .eight").toggleClass("rotate");
- });
-
- //SHOW HIDE FOR PRADESH
- $(document).ready(function() {
- $('#show-hidden-menu').click(function() {
- $('.hidden-menu').slideToggle("slow");
- // Alternative animation for example
- // slideToggle("fast");
- });
- });
-
- //PHOTO GALLERY
- $('.owl-carousel.photo-gallery-carousel').owlCarousel({
- loop:true,
- margin:10,
- nav:false,
- autoplay: true,
- responsive:{
- 0:{
- items:2
- },
- 600:{
- items:3
- },
- 1000:{
- items:4
- }
- }
- })
-
- //MATCH HEIGHT
- //ANTARBARTA TITLE
- $(document).ready(function(){
- $('.antarbartaTitle').matchHeight();
- })
-
- //ANTARBARTA PARAGRAPH
- $(document).ready(function(){
- $('.antarbartaPara').matchHeight();
- })
-
- //PRADESH
- $(document).ready(function(){
- $('.pradesh-image').matchHeight();
- })
- // FIXED NAVBAR
- $(window).scroll(function () {
- if ($(this).scrollTop() > 120) {
- $(".header-wrapper").addClass("fixed");
- } else {
- $(".header-wrapper").removeClass("fixed");
- }
- });
-
-
\ No newline at end of file
+});
+
+//initialize ckeditor
+document.querySelectorAll('.ckeditor-classic').forEach(editor => {
+ ClassicEditor
+ .create(editor)
+ .catch(error => {
+ console.error(error);
+ });
+
+});
+
+// //initialize select2
+// $('.dropify').dropify();
+
+// //initialize select2
+// $('.select2').select2();
+
+// $('body').on('keyup', '.numeric', function () {
+// this.value = this.value.replace(/[^0-9\.]/g, '');
+// });
+
+// $(".flatpickr-date").flatpickr({
+// enableTime: false,
+// dateFormat: "Y-m-d",
+// altInput: true,
+// altFormat: "Y-m-d",
+// defaultDate: "",
+// });
+
+// $(".flatpickr-time").flatpickr({
+// enableTime: true,
+// noCalendar: false,
+// dateFormat: "H:i",
+// time_24hr: false,
+// });
diff --git a/resources/js/custom.js b/resources/js/custom.js
new file mode 100644
index 0000000..01e36da
--- /dev/null
+++ b/resources/js/custom.js
@@ -0,0 +1,69 @@
+
+$('body').on('click', '.remove-item-btn', function (e) {
+ e.preventDefault();
+ let url = $(this).data('link');
+ let id = $(this).data('id');
+ 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({
+ url: url,
+ type: 'DELETE',
+ headers: {
+ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
+ },
+ data: {
+ id: id
+ },
+ success: function (response) {
+ location.reload();
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ }
+ });
+ }
+ });
+});
+
+//initialize ckeditor
+document.querySelectorAll('.ckeditor-classic').forEach(editor => {
+ ClassicEditor
+ .create(editor)
+ .catch(error => {
+ console.error(error);
+ });
+
+});
+
+//initialize select2
+$('.dropify').dropify();
+
+//initialize select2
+$('.select2').select2();
+
+$('body').on('keyup', '.numeric', function () {
+ this.value = this.value.replace(/[^0-9\.]/g, '');
+});
+
+$(".flatpickr-date").flatpickr({
+ enableTime: false,
+ dateFormat: "Y-m-d",
+ altInput: true,
+ altFormat: "Y-m-d",
+ defaultDate: "",
+});
+
+$(".flatpickr-time").flatpickr({
+ enableTime: true,
+ noCalendar: false,
+ dateFormat: "H:i",
+ time_24hr: false,
+});
\ No newline at end of file
diff --git a/resources/views/backend/sidebar.blade.php b/resources/views/backend/sidebar.blade.php
index ff39c01..55a700d 100644
--- a/resources/views/backend/sidebar.blade.php
+++ b/resources/views/backend/sidebar.blade.php
@@ -108,7 +108,7 @@
@role('admin')
-
+ {{--
--}}
+
+
+
+
@endrole
@@ -131,6 +145,7 @@
{{ CCMS::createMenuLink('Artilces', route('articles.index')) }}
{{ CCMS::createMenuLink('Teams', route('teams.index')) }}
{{ CCMS::createMenuLink('Popup', route('popups.index')) }}
+ {{ CCMS::createMenuLink('Comments', route('comments.index')) }}
diff --git a/resources/views/backend/template.blade.php b/resources/views/backend/template.blade.php
index 36f4cd7..ab6e4df 100644
--- a/resources/views/backend/template.blade.php
+++ b/resources/views/backend/template.blade.php
@@ -1,241 +1,247 @@
+ data-sidebar-image="none" data-preloader="disable">
-
- {{ config('app.name') }} - Admin Dashboard
-
-
-
-
-
+
+ {{ config('app.name') }} - Admin Dashboard
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
-
- @stack('css')
-
-
+
+ @stack('css')
+
+
-
-
+
+
- @include('backend.header')
+ @include('backend.header')
- @include('backend.sidebar')
+ @include('backend.sidebar')
-
+
-
+
-
-
+
+
- @yield('content')
+ @yield('content')
-
+
-
-
-
+
+
-
+
-
-
-
-
-
+
+ ?>
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
- -->
+
+
+ jQuery(document).ready(function($) {
+ $('.datepicker').datepicker({
+ format: 'yyyy-mm-dd',
+ autoclose: true
+ });
+ });
+
-
+
-
-
-
+
+
+
- @if (isset($GLOBALS['scripts']))
- {!! implode(PHP_EOL, $GLOBALS['scripts']) !!}
- @endif
+ @if (isset($GLOBALS['scripts']))
+ {!! implode(PHP_EOL, $GLOBALS['scripts']) !!}
+ @endif
- @stack('js')
+ @stack('js')
diff --git a/resources/views/components/form-buttons.blade.php b/resources/views/components/form-buttons.blade.php
new file mode 100644
index 0000000..9abb6fc
--- /dev/null
+++ b/resources/views/components/form-buttons.blade.php
@@ -0,0 +1,6 @@
+@props(['editable' => false, 'label' => 'Add', 'href' => '#'])
+
+
+ {{ html()->a($href = $href, $text = 'Cancel')->class('btn btn-danger') }}
+ {{ html()->button($editable ? 'Update' : $label, 'submit')->class('btn btn-success') }}
+
diff --git a/resources/views/crud/generated/comments/create.blade.php b/resources/views/crud/generated/comments/create.blade.php
new file mode 100644
index 0000000..1fc2aca
--- /dev/null
+++ b/resources/views/crud/generated/comments/create.blade.php
@@ -0,0 +1,29 @@
+@extends('backend.template')
+@section('content')
+
+
+
+@endsection
diff --git a/resources/views/crud/generated/comments/edit.blade.php b/resources/views/crud/generated/comments/edit.blade.php
new file mode 100644
index 0000000..7b7210d
--- /dev/null
+++ b/resources/views/crud/generated/comments/edit.blade.php
@@ -0,0 +1,30 @@
+@extends('backend.template')
+@section('content')
+
+
+
+@endsection
diff --git a/resources/views/crud/generated/comments/index.blade.php b/resources/views/crud/generated/comments/index.blade.php
new file mode 100644
index 0000000..345885f
--- /dev/null
+++ b/resources/views/crud/generated/comments/index.blade.php
@@ -0,0 +1,244 @@
+@extends('backend.template')
+@section('content')
+
+@endsection
+
+@push('css')
+
+
+@endpush
+@push('js')
+
+
+
+
+
+
+
+
+
+
+@endpush
diff --git a/resources/views/crud/generated/users/show.blade.php b/resources/views/crud/generated/comments/show.blade.php
similarity index 60%
rename from resources/views/crud/generated/users/show.blade.php
rename to resources/views/crud/generated/comments/show.blade.php
index e13be0c..22501d1 100644
--- a/resources/views/crud/generated/users/show.blade.php
+++ b/resources/views/crud/generated/comments/show.blade.php
@@ -3,14 +3,14 @@
-
Name : {{$data->name}}
Email : {{$data->email}}
Username : {{$data->username}}
Email Verified At : {{$data->email_verified_at}}
Password : {{$data->password}}
Role : {{$data->role}}
Remember Token : {{$data->remember_token}}
Status : Parent Id : {{$data->parent_id}}
Users Id : {{$data->users_id}}
News Id : {{$data->news_id}}
Content : {{$data->content}}
Status : {{$data->status == 1 ? 'Active' : 'Inactive'}}
Created On : {{$data->created_at}}
diff --git a/resources/views/crud/generated/partials/role/action.blade.php b/resources/views/crud/generated/partials/role/action.blade.php
new file mode 100644
index 0000000..c816a64
--- /dev/null
+++ b/resources/views/crud/generated/partials/role/action.blade.php
@@ -0,0 +1,137 @@
+
+
+
+ {{ html()->label('Name')->class('form-label') }}
+ {{ html()->text('name')->class('form-control')->placeholder('Enter Role Name')->required() }}
+
+
+
+ {{ html()->label('Guard Name')->class('form-label') }}
+ {{ html()->text('guard_name', 'web')->class('form-control')->isReadonly($readonly = true) }}
+
+
+
+
+ {{ html()->checkbox('all_permissions_check')->class('form-check-input')->id('all-check') }}
+ {{ html()->label('Select All')->class('form-check-label')->for('all-check') }}
+
+ {{ html()->p()->text('Enable all Permissions for this role')->class('fs-6 text-muted mt-1') }}
+
+
+
+
+
+
+ @foreach ($permissionLists as $key => $permission)
+
+
+
+ {{ Str::ucfirst($key) }}
+
+
+ Permissions
+
+
+ @foreach ($permission as $index => $item)
+
+
+ {{ html()->checkbox('permissions[]')->id('permission_' . $index)->value($index)->class('form-check-input child-checkbox')->checked($editable && in_array($index, $permissionIDsArray)) }}
+ {{ html()->label(Str::ucfirst($item))->for('permission_' . $index)->class('form-check-label ms-2') }}
+
+
+ @endforeach
+
+
+
+
+
+ @endforeach
+
+
+
+ @push('js')
+
+ @endpush
+
\ No newline at end of file
diff --git a/resources/views/crud/generated/partials/role/view.blade.php b/resources/views/crud/generated/partials/role/view.blade.php
new file mode 100644
index 0000000..6b3c759
--- /dev/null
+++ b/resources/views/crud/generated/partials/role/view.blade.php
@@ -0,0 +1,17 @@
+
+
\ No newline at end of file
diff --git a/resources/views/crud/generated/partials/user/action.blade.php b/resources/views/crud/generated/partials/user/action.blade.php
new file mode 100644
index 0000000..453743e
--- /dev/null
+++ b/resources/views/crud/generated/partials/user/action.blade.php
@@ -0,0 +1,33 @@
+
+
+ {{--
+ {{ html()->label('For Employee')->class('form-label') }}
+ {{ html()->select('employee_id', $employeeLists)->class('form-select select2')->placeholder('Select Employee') }}
+ {{ html()->div('please select employee')->class('invalid-feedback') }}
+
--}}
+
+
+ {{ html()->label('Role')->class('form-label') }}
+ {{ html()->select('role[]', $roleLists, $editable ? $user->roles?->first()->id : null)->class('form-select select2')->placeholder('Select Role')->required() }}
+ {{ html()->div('please select role')->class('invalid-feedback') }}
+
+
+
+ {{ html()->label('Username')->class('form-label') }}
+ {{ html()->text('name')->class('form-control')->placeholder('Enter Username')->required() }}
+
+
+
+ {{ html()->label('Email')->class('form-label') }}
+ {{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
+
+
+
+
+ {{ html()->label('Password')->class('form-label') }}
+ {{ html()->password('password')->class('form-control')->placeholder('Enter Password')->required() }}
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/crud/generated/partials/user/view.blade.php b/resources/views/crud/generated/partials/user/view.blade.php
new file mode 100644
index 0000000..064fb98
--- /dev/null
+++ b/resources/views/crud/generated/partials/user/view.blade.php
@@ -0,0 +1,17 @@
+
+
\ No newline at end of file
diff --git a/resources/views/crud/generated/permissions/action.blade.php b/resources/views/crud/generated/permissions/action.blade.php
new file mode 100644
index 0000000..0b850dd
--- /dev/null
+++ b/resources/views/crud/generated/permissions/action.blade.php
@@ -0,0 +1,122 @@
+
+
+ @foreach ($permissionLists as $key => $permission)
+ {{-- @dd($permissionLists); --}}
+
+ {{--
--}}
+
+ {{-- --}}
+ {{ Str::ucfirst($key) }}
+
+ {{-- {{ Str::ucfirst($key) }}
+ --}}
+
+ Permissions
+
+
+ @foreach ($permission as $index => $item)
+
+ @endforeach
+
+
+
+
+ @endforeach
+
+
+
+ @push('js')
+
+ @endpush
diff --git a/resources/views/crud/generated/permissions/create.blade.php b/resources/views/crud/generated/permissions/create.blade.php
deleted file mode 100644
index 79b593f..0000000
--- a/resources/views/crud/generated/permissions/create.blade.php
+++ /dev/null
@@ -1,17 +0,0 @@
-@extends('backend.template')
- @section('content')
-
-
-
-@endsection
\ No newline at end of file
diff --git a/resources/views/crud/generated/permissions/edit.blade.php b/resources/views/crud/generated/permissions/edit.blade.php
deleted file mode 100644
index 509163f..0000000
--- a/resources/views/crud/generated/permissions/edit.blade.php
+++ /dev/null
@@ -1,25 +0,0 @@
-@extends('backend.template')
-@section('content')
-
-
-
-@endsection
diff --git a/resources/views/crud/generated/permissions/index.blade.php b/resources/views/crud/generated/permissions/index.blade.php
index e6936e2..8accc5f 100644
--- a/resources/views/crud/generated/permissions/index.blade.php
+++ b/resources/views/crud/generated/permissions/index.blade.php
@@ -1,185 +1,59 @@
@extends('backend.template')
@section('content')
-
-
-
-
-
-
- {{ label('Sn.') }}
- {{ label('name') }}
- {{ label('guard_name') }}
- {{ label('Action') }}
-
-
-
-
- @php
- $i = 1;
- @endphp
- @foreach ($data as $item)
-
- {{ $i++ }}
- {{ $item->name }}
- {{ $item->guard_name }}
-
-
-
-
-
-
-
- @endforeach
+
-
-
+
+
+
+
+
+
+ @include('crud.generated.permissions.action')
+
+
+
+
+
@endsection
-
@push('css')
-
-
+
+
+
@endpush
+
@push('js')
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@endpush
diff --git a/resources/views/crud/generated/permissions/show.blade.php b/resources/views/crud/generated/permissions/show.blade.php
deleted file mode 100644
index 0df399a..0000000
--- a/resources/views/crud/generated/permissions/show.blade.php
+++ /dev/null
@@ -1,28 +0,0 @@
-@extends('backend.template')
- @section('content')
-
-
-
-
-
-
-
Name : {{$data->name}}
Guard Name : {{$data->guard_name}}
-
-
Created On : {{$data->created_at}}
-
Created By : {{$data->createdBy}}
-
-
-
Updated On : {{$data->updated_at}}
-
Updated By : {{$data->updatedBy}}
-
-
-
-
-
-
-
-@endSection
\ No newline at end of file
diff --git a/resources/views/crud/generated/roles/create.blade.php b/resources/views/crud/generated/roles/create.blade.php
index 7f47474..eebf2a8 100644
--- a/resources/views/crud/generated/roles/create.blade.php
+++ b/resources/views/crud/generated/roles/create.blade.php
@@ -1,34 +1,43 @@
@extends('backend.template')
@section('content')
-
-
{{ $item->content }}
++ @foreach ($item->subcomments as $subcomment) +-
+
+
+
+
+ {{ $subcomment->user?->name }}
+
+
+
+
+ {{-- @if ($loop->last)
+
+
+ @csrf
+
+
+
+
+
+
+
+ @endif --}}
+
+
+ @endforeach
+
+ @else +{{ $subcomment->content }}
+