update
This commit is contained in:
parent
25760ad989
commit
f85671cd4c
34
app/Console/Commands/GeneratePermissions.php
Normal file
34
app/Console/Commands/GeneratePermissions.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Repositories\PermissionRepository;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
|
||||||
|
class GeneratePermissions extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'permissions:generate';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Generate Permissions From Named Route';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$this->info('Generating Permissions');
|
||||||
|
PermissionRepository::generatePermissionFromRoutes();
|
||||||
|
$this->info('Permissions generated successfully!');
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel
|
|||||||
protected function commands(): void
|
protected function commands(): void
|
||||||
{
|
{
|
||||||
$this->load(__DIR__.'/Commands');
|
$this->load(__DIR__.'/Commands');
|
||||||
|
// $this->load(__DIR__.'/Commands/GeneratePermissions.php');
|
||||||
|
|
||||||
require base_path('routes/console.php');
|
require base_path('routes/console.php');
|
||||||
}
|
}
|
||||||
|
@ -33,23 +33,213 @@ class CCMS
|
|||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
// private function initDB()
|
|
||||||
// {
|
|
||||||
// static $initialized = false;
|
|
||||||
// if (!$initialized) {
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// if (!(DB::table('users')->first())) {
|
function generateEstimateNumber()
|
||||||
// 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');");
|
{
|
||||||
// }
|
$lastEstimate = Estimate::withTrashed()->latest()->first();
|
||||||
// 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;
|
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);
|
||||||
|
}
|
||||||
|
@ -49,7 +49,7 @@ class AuthenticationController extends Controller
|
|||||||
'phone' => ['required', 'integer'],
|
'phone' => ['required', 'integer'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
User::create([
|
$user = User::create([
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'email' => $request->email,
|
'email' => $request->email,
|
||||||
'password' => bcrypt($request->password),
|
'password' => bcrypt($request->password),
|
||||||
@ -59,6 +59,7 @@ class AuthenticationController extends Controller
|
|||||||
'email_verified_at' => now()
|
'email_verified_at' => now()
|
||||||
])->assignRole('user');
|
])->assignRole('user');
|
||||||
|
|
||||||
|
dd($user);
|
||||||
return response()->json(['success' => true, 'message' => 'User created successfully!', 'redirect_url' => route('userLogin')]);
|
return response()->json(['success' => true, 'message' => 'User created successfully!', 'redirect_url' => route('userLogin')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
171
app/Http/Controllers/CommentsController.php
Normal file
171
app/Http/Controllers/CommentsController.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Comments;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use App\Repositories\CommentsRepository;
|
||||||
|
use Log;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class CommentsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
protected $commentRepository;
|
||||||
|
public function __construct(Comments $model, CommentsRepository $commentRepository)
|
||||||
|
{
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,148 +3,104 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\RoleRepository;
|
||||||
use Illuminate\Http\Request;
|
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\Permission;
|
||||||
use Spatie\Permission\Models\Role;
|
use App\Repositories\PermissionRepository;
|
||||||
use Log;
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class PermissionsController extends Controller
|
class PermissionsController extends Controller
|
||||||
{
|
{
|
||||||
protected $modelService;
|
private $permissionRepository;
|
||||||
public function __construct(Permission $model)
|
private $role;
|
||||||
{
|
|
||||||
$this->modelService = new CommonModelService($model);
|
|
||||||
}
|
|
||||||
public function index(Request $request)
|
|
||||||
{
|
|
||||||
createActivityLog(PermissionsController::class, 'index', ' Permissions index');
|
|
||||||
$data = Permission::get();
|
|
||||||
|
|
||||||
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');
|
$data['editable'] = false;
|
||||||
$TableData = Permission::get();
|
$data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
|
||||||
return view("crud.generated.permissions.create", compact('TableData'));
|
return view('user::role.create', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
public function store(Request $request)
|
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)
|
/**
|
||||||
{
|
* Display the specified resource.
|
||||||
$idOrder = $request->input('id_order');
|
*/
|
||||||
|
public function show(string $id)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
public function show(Request $request, $id)
|
public function edit(Permission $permission)
|
||||||
{
|
{
|
||||||
createActivityLog(PermissionsController::class, 'show', ' Permissions show');
|
$data['title'] = "Edit Role";
|
||||||
$data = Permission::findOrFail($id);
|
$data['editable'] = true;
|
||||||
|
$data['role'] = $this->role->getRoleById($id);
|
||||||
return view("crud.generated.permissions.show", compact('data'));
|
$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)
|
* Update the specified resource in storage.
|
||||||
{
|
*/
|
||||||
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'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function update(Request $request, Permission $permission)
|
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');
|
$permissionDelete = $this->permissionRepository->getPermissionById($id);
|
||||||
DB::beginTransaction();
|
|
||||||
try {
|
$permissionDelete->delete();
|
||||||
$OperationNumber = getOperationNumber();
|
return response()->json(['status' => true, 'message' => 'Permission has been deleted'] );
|
||||||
$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);
|
|
||||||
}
|
}
|
||||||
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 {
|
try {
|
||||||
$OperationNumber = getOperationNumber();
|
$this->permissionRepository->generatePermissionFromRoutes();
|
||||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
toastr()->success('Permission generated successfully!');
|
||||||
} catch (Exception $e) {
|
} catch (\Throwable $th) {
|
||||||
DB::rollBack();
|
toastr()->error($th->getMessage());
|
||||||
Log::info($e->getMessage());
|
|
||||||
createErrorLog(PermissionsController::class, 'destroy', $e->getMessage());
|
|
||||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
|
||||||
}
|
}
|
||||||
DB::commit();
|
return to_route('permissions.index');
|
||||||
return response()->json(['status' => true, 'message' => 'The Permissions Deleted Successfully.'], 200);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,123 +3,101 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\PermissionRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Roles;
|
use App\Models\Roles;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Brian2694\Toastr\Facades\Toastr;
|
||||||
use App\Service\CommonModelService;
|
use App\Repositories\RoleRepository;
|
||||||
use Spatie\Permission\Models\Role;
|
|
||||||
use Spatie\Permission\Models\Permission;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class RolesController extends Controller
|
class RolesController extends Controller
|
||||||
{
|
{
|
||||||
protected $modelService;
|
private $roleRepository;
|
||||||
public function __construct(Roles $model)
|
private $permissionRepository;
|
||||||
{
|
public function __construct(
|
||||||
$this->modelService = new CommonModelService($model);
|
RoleRepository $roleRepository,
|
||||||
|
PermissionRepository $permissionRepository
|
||||||
|
) {
|
||||||
|
$this->roleRepository = $roleRepository;
|
||||||
|
$this->permissionRepository = $permissionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
|
$data['title'] = "List Roles";
|
||||||
createActivityLog(RolesController::class, 'index', ' Roles index');
|
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');
|
$data['title'] = "Create Role";
|
||||||
$TableData = Roles::get();
|
$data['editable'] = false;
|
||||||
$permissions = Permission::all();
|
$data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
|
||||||
return view("crud.generated.roles.create", compact('TableData', 'permissions'));
|
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']]);
|
try {
|
||||||
$role = Role::create($validated);
|
|
||||||
|
|
||||||
if ($role->hasPermissionTo($request->permission, 'web')) {
|
$validatedData = $request->validate([
|
||||||
return back()->with('message', 'Permission exists.');
|
'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);
|
return redirect()->route('roles.index');
|
||||||
|
|
||||||
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.');
|
|
||||||
}
|
}
|
||||||
|
public function show(string $id)
|
||||||
public function sort(Request $request)
|
|
||||||
{
|
{
|
||||||
$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 edit($id)
|
||||||
|
|
||||||
public function show(Request $request, $id)
|
|
||||||
{
|
{
|
||||||
createActivityLog(RolesController::class, 'show', ' Roles show');
|
$data['title'] = "Edit Role";
|
||||||
$data = Roles::findOrFail($id);
|
$data['editable'] = false;
|
||||||
|
$data['role'] = $this->roleRepository->getRoleById($id);
|
||||||
return view("crud.generated.roles.show", compact('data'));
|
$data['permissionIDsArray'] = $data['role']?->permissions?->pluck('id')->toArray();
|
||||||
|
$data['permissionLists'] = $this->permissionRepository->getPermissionListsArrangedByPrefix();
|
||||||
|
return view('crud.generated.roles.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id): RedirectResponse
|
||||||
public function edit(Request $request, $id)
|
|
||||||
{
|
{
|
||||||
createActivityLog(RolesController::class, 'edit', ' Roles edit');
|
try {
|
||||||
$permissions = Permission::all();
|
$validatedData = $request->validate([
|
||||||
$TableData = Role::get();
|
'name' => 'required',
|
||||||
$data = Role::findOrFail($id);
|
'guard_name' => 'string',
|
||||||
if ($request->ajax()) {
|
]);
|
||||||
$html = view("crud.generated.roles.ajax.edit", compact('data'))->render();
|
|
||||||
return response()->json(['status' => true, 'content' => $html], 200);
|
$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 destroy($id)
|
||||||
public function update(Request $request, Role $role)
|
|
||||||
{
|
{
|
||||||
$permission = $request->permission;
|
$this->roleRepository->delete($id);
|
||||||
$validated = $request->validate(['name' => ['required', 'min:3']]);
|
Toastr::success('Role has been deleted', 'Title', ["positionClass" => "toast-top-center"]);
|
||||||
$role->update($validated);
|
return response()->json(['status' => true, 'message' => 'Role has been deleted!']);
|
||||||
|
|
||||||
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.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,115 +3,135 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\RoleInterface;
|
||||||
|
use App\Repositories\RoleRepository;
|
||||||
|
use App\Repositories\UserRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\User;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Brian2694\Toastr\Facades\Toastr;
|
||||||
use Spatie\Permission\Models\Permission;
|
|
||||||
use Spatie\Permission\Models\Role;
|
|
||||||
use App\Service\CommonModelService;
|
|
||||||
use Log;
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class UsersController extends Controller
|
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['users'] = $this->userRepository->findAll();
|
||||||
$data = User::get();
|
$data['editable'] = false;
|
||||||
return view("crud.generated.users.index", compact('data'));
|
$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['title'] = "Create User";
|
||||||
$data = User::findOrFail($id);
|
$data['editable'] = false;
|
||||||
return view("crud.generated.User.show", compact('data'));
|
$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');
|
// try {
|
||||||
$TableData = User::get();
|
|
||||||
$data = User::findOrFail($id);
|
|
||||||
$roles = Role::all();
|
|
||||||
$permissions = Permission::all();
|
|
||||||
|
|
||||||
if ($request->ajax()) {
|
$validated = $request->validate([
|
||||||
$html = view("crud.generated.User.ajax.edit", compact('data'))->render();
|
'name' => 'required|min:5',
|
||||||
return response()->json(['status' => true, 'content' => $html], 200);
|
'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());
|
$data['user'] = $this->userRepository->getUserById($id);
|
||||||
|
return view('user::user.show');
|
||||||
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.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Request $request, $id)
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
{
|
{
|
||||||
createActivityLog(UsersController::class, 'destroy', 'User destroy');
|
$data['title'] = "Edit User";
|
||||||
DB::beginTransaction();
|
$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 {
|
try {
|
||||||
$OperationNumber = getOperationNumber();
|
|
||||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
$validated = $request->validate([
|
||||||
} catch (Exception $e) {
|
'name' => 'required|min:5',
|
||||||
DB::rollBack();
|
'email' => 'required',
|
||||||
Log::info($e->getMessage());
|
'password' => 'required',
|
||||||
createErrorLog(UsersController::class, 'destroy', $e->getMessage());
|
]);
|
||||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
|
||||||
|
$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 redirect()->route('user.index');
|
||||||
return response()->json(['status' => true, 'message' => 'The User Deleted Successfully.'], 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeRole(User $user, Role $role)
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
if ($user->hasRole($role)) {
|
try {
|
||||||
$user->removeRole($role);
|
|
||||||
return back()->with('message', 'Role removed.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return back()->with('message', 'Role not exists.');
|
$this->userRepository->delete($id);
|
||||||
}
|
|
||||||
|
|
||||||
public function revokePermission(User $user, Permission $permission)
|
Toastr::success('User has been deleted', 'Title', ["positionClass" => "toast-top-center"]);
|
||||||
{
|
} catch (\Throwable $th) {
|
||||||
if ($user->hasPermissionTo($permission)) {
|
|
||||||
$user->revokePermissionTo($permission);
|
Toastr::success('Error deleting user', 'Title', ["positionClass" => "toast-top-center"]);
|
||||||
return back()->with('message', 'Permission revoked.');
|
|
||||||
}
|
}
|
||||||
return back()->with('message', 'Permission does not exists.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Mail\sendEmail;
|
use App\Mail\sendEmail;
|
||||||
use App\Models\Advertisements;
|
use App\Models\Advertisements;
|
||||||
use App\Models\Articles;
|
use App\Models\Articles;
|
||||||
|
use App\Models\Comments;
|
||||||
use App\Models\Economies;
|
use App\Models\Economies;
|
||||||
use App\Models\Horoscopes;
|
use App\Models\Horoscopes;
|
||||||
use App\Models\Menuitems;
|
use App\Models\Menuitems;
|
||||||
@ -18,6 +19,7 @@ use App\Models\Teams;
|
|||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
use App\Models\Videos;
|
use App\Models\Videos;
|
||||||
use Share;
|
use Share;
|
||||||
|
|
||||||
@ -27,6 +29,13 @@ class WebsiteController extends Controller
|
|||||||
|
|
||||||
public function __construct()
|
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');
|
$this->path = config('app.client_path');
|
||||||
|
|
||||||
$headerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 1])->with('children')->orderBy('display_order')->get();
|
$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();
|
$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();
|
$adsWithChildren = Advertisements::where('status', 1)->where('parent_advertisement', 0)->orderBy('display_order')->with('children')->get();
|
||||||
$popup = Popups::where('status',1)->latest()->first();
|
$popup = Popups::where('status',1)->latest()->first();
|
||||||
|
$route = Route::getRoutes();
|
||||||
|
|
||||||
View::share(
|
View::share(
|
||||||
[
|
[
|
||||||
'headerMenuItems' => $headerMenuItems,
|
'headerMenuItems' => $headerMenuItems,
|
||||||
@ -104,7 +115,8 @@ class WebsiteController extends Controller
|
|||||||
|
|
||||||
$news->views_count = $news->views_count + 1;
|
$news->views_count = $news->views_count + 1;
|
||||||
$news->save();
|
$news->save();
|
||||||
|
$newsWithComment = News::with('comments')->where('news_id', $news->news_id)->get();
|
||||||
|
// dd($newsWithComment->toArray());
|
||||||
$recentNews = News::where('status', 1)
|
$recentNews = News::where('status', 1)
|
||||||
->where('news_id', '!=', $news->news_id)
|
->where('news_id', '!=', $news->news_id)
|
||||||
->inRandomOrder()
|
->inRandomOrder()
|
||||||
@ -112,7 +124,7 @@ class WebsiteController extends Controller
|
|||||||
->latest()
|
->latest()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent'));
|
return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent','newsWithComment'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ class Kernel extends HttpKernel
|
|||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\App\Http\Middleware\PermissionMiddleware::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
@ -64,8 +65,8 @@ class Kernel extends HttpKernel
|
|||||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
// 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||||
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
'permission' => \App\Http\Middleware\PermissionMiddleware::class,
|
||||||
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
|
// 'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
62
app/Http/Middleware/PermissionMiddleware.php
Normal file
62
app/Http/Middleware/PermissionMiddleware.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Spatie\Permission\Exceptions\UnauthorizedException;
|
||||||
|
use Spatie\Permission\Guard;
|
||||||
|
|
||||||
|
class PermissionMiddleware
|
||||||
|
{
|
||||||
|
public function handle($request, Closure $next, $guard = null)
|
||||||
|
{
|
||||||
|
$authGuard = Auth::guard($guard);
|
||||||
|
|
||||||
|
$user = $authGuard->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;
|
||||||
|
}
|
||||||
|
}
|
53
app/Models/Comments.php
Normal file
53
app/Models/Comments.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Comments extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'parent_id',
|
||||||
|
'users_id',
|
||||||
|
'news_id',
|
||||||
|
'content',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -89,4 +89,12 @@ class News extends Model
|
|||||||
public function provinces(): BelongsTo{
|
public function provinces(): BelongsTo{
|
||||||
return $this->belongsTo(Provinces::class, 'provinces_id', 'province_id');
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,4 +45,8 @@ class User extends Authenticatable
|
|||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'password' => 'hashed',
|
'password' => 'hashed',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function comments(){
|
||||||
|
return $this->hasMany(Comments::class,'users_id','id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface AdCategoriesInterface
|
interface AdCategoriesInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Adcategories;
|
use App\Models\Adcategories;
|
||||||
use App\Repositories\Interface\AdCategoriesInterface;
|
use App\Repositories\AdCategoriesInterface;
|
||||||
|
|
||||||
|
|
||||||
class AdCategoryRepository implements AdCategoriesInterface
|
class AdCategoryRepository implements AdCategoriesInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface AdvertisementInterface
|
interface AdvertisementInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Advertisements;
|
use App\Models\Advertisements;
|
||||||
use App\Repositories\Interface\AdvertisementInterface;
|
use App\Repositories\AdvertisementInterface;
|
||||||
|
|
||||||
|
|
||||||
class AdvertisementRepository implements AdvertisementInterface
|
class AdvertisementRepository implements AdvertisementInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface ArticleInterface
|
interface ArticleInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Articles;
|
use App\Models\Articles;
|
||||||
use App\Repositories\Interface\ArticleInterface;
|
use App\Repositories\ArticleInterface;
|
||||||
|
|
||||||
|
|
||||||
class ArticleRepository implements ArticleInterface
|
class ArticleRepository implements ArticleInterface
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Repositories\Interface\AuthorsInterface;
|
use App\Repositories\AuthorsInterface;
|
||||||
use App\Models\Authors;
|
use App\Models\Authors;
|
||||||
|
|
||||||
class AuthorRepository implements AuthorsInterface
|
class AuthorRepository implements AuthorsInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface AuthorsInterface
|
interface AuthorsInterface
|
||||||
{
|
{
|
9
app/Repositories/CommentsInterface.php
Normal file
9
app/Repositories/CommentsInterface.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
interface CommentsInterface{
|
||||||
|
public function create(array $Details);
|
||||||
|
public function update($commentId, array $newDetails);
|
||||||
|
public function delete($commentId);
|
||||||
|
}
|
25
app/Repositories/CommentsRepository.php
Normal file
25
app/Repositories/CommentsRepository.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Models\Comments;
|
||||||
|
use App\Repositories\CommentsInterface;
|
||||||
|
|
||||||
|
class CommentsRepository implements CommentsInterface
|
||||||
|
{
|
||||||
|
public function create(array $Details)
|
||||||
|
{
|
||||||
|
// dd($Details);
|
||||||
|
return Comments::create($Details);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($commentId, array $Details)
|
||||||
|
{
|
||||||
|
return Comments::where('id', $commentId)->update($Details);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($commentId)
|
||||||
|
{
|
||||||
|
return Comments::where('id', $commentId)->delete();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface EconomyInterface
|
interface EconomyInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Economies;
|
use App\Models\Economies;
|
||||||
use App\Repositories\Interface\EconomyInterface;
|
use App\Repositories\EconomyInterface;
|
||||||
|
|
||||||
|
|
||||||
class EconomyRepository implements EconomyInterface
|
class EconomyRepository implements EconomyInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface HoroscopeInterface
|
interface HoroscopeInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Horoscopes;
|
use App\Models\Horoscopes;
|
||||||
use App\Repositories\Interface\HoroscopeInterface;
|
use App\Repositories\HoroscopeInterface;
|
||||||
|
|
||||||
|
|
||||||
class HoroscopeRepository implements HoroscopeInterface
|
class HoroscopeRepository implements HoroscopeInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface NewsCategoriesInterface
|
interface NewsCategoriesInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Newscategories;
|
use App\Models\Newscategories;
|
||||||
use App\Repositories\Interface\NewsCategoriesInterface;
|
use App\Repositories\NewsCategoriesInterface;
|
||||||
|
|
||||||
class NewsCategoriesRepository implements NewsCategoriesInterface
|
class NewsCategoriesRepository implements NewsCategoriesInterface
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface NewsInterface
|
interface NewsInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\News;
|
use App\Models\News;
|
||||||
use App\Repositories\Interface\NewsInterface;
|
use App\Repositories\NewsInterface;
|
||||||
|
|
||||||
class NewsRepository implements NewsInterface
|
class NewsRepository implements NewsInterface
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface NewsTypeInterface
|
interface NewsTypeInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\News_type;
|
use App\Models\News_type;
|
||||||
use App\Repositories\Interface\NewsTypeInterface;
|
use App\Repositories\NewsTypeInterface;
|
||||||
|
|
||||||
|
|
||||||
class NewsTypeRepository implements NewsTypeInterface
|
class NewsTypeRepository implements NewsTypeInterface
|
||||||
|
15
app/Repositories/PermissionInterface.php
Normal file
15
app/Repositories/PermissionInterface.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
interface PermissionInterface
|
||||||
|
{
|
||||||
|
public function findAll();
|
||||||
|
public function getPermissionById($permissionId);
|
||||||
|
public function delete($permissionId);
|
||||||
|
public function create(array $permissionDetails);
|
||||||
|
public function update($permissionId, array $newDetails);
|
||||||
|
public function getRoleById($roleId);
|
||||||
|
public function getPermissionListsArrangedByPrefix();
|
||||||
|
public static function generatePermissionFromRoutes();
|
||||||
|
}
|
121
app/Repositories/PermissionRepository.php
Normal file
121
app/Repositories/PermissionRepository.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Repositories\PermissionInterface;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
|
class PermissionRepository implements PermissionInterface
|
||||||
|
{
|
||||||
|
public function findAll()
|
||||||
|
{
|
||||||
|
return Permission::get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPermissionById($permissionId)
|
||||||
|
{
|
||||||
|
return Permission::findOrFail($permissionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($permissionId)
|
||||||
|
{
|
||||||
|
Permission::destroy($permissionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(array $permissionDetails)
|
||||||
|
{
|
||||||
|
return Permission::create($permissionDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoleById($roleId)
|
||||||
|
{
|
||||||
|
return Role::with('permissions')->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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface PopupInterface
|
interface PopupInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Popups;
|
use App\Models\Popups;
|
||||||
use App\Repositories\Interface\PopupInterface;
|
use App\Repositories\PopupInterface;
|
||||||
|
|
||||||
class PopupRepository implements PopupInterface
|
class PopupRepository implements PopupInterface
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface ProvinceInterface
|
interface ProvinceInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Provinces;
|
use App\Models\Provinces;
|
||||||
use App\Repositories\Interface\ProvinceInterface;
|
use App\Repositories\ProvinceInterface;
|
||||||
|
|
||||||
|
|
||||||
class ProvinceRepository implements ProvinceInterface
|
class ProvinceRepository implements ProvinceInterface
|
||||||
|
13
app/Repositories/RoleInterface.php
Normal file
13
app/Repositories/RoleInterface.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
interface RoleInterface
|
||||||
|
{
|
||||||
|
public function pluck();
|
||||||
|
public function findAll();
|
||||||
|
public function getRoleById($roleId);
|
||||||
|
public function delete($roleId);
|
||||||
|
public function create(array $RoleDetails);
|
||||||
|
public function update($roleId, array $newDetails);
|
||||||
|
}
|
57
app/Repositories/RoleRepository.php
Normal file
57
app/Repositories/RoleRepository.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
|
class RoleRepository implements RoleInterface
|
||||||
|
{
|
||||||
|
public function pluck()
|
||||||
|
{
|
||||||
|
return Role::pluck('name', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll()
|
||||||
|
{
|
||||||
|
return Role::with('permissions')->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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface SettingInterface
|
interface SettingInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Settings;
|
use App\Models\Settings;
|
||||||
use App\Repositories\Interface\SettingInterface;
|
use App\Repositories\SettingInterface;
|
||||||
|
|
||||||
class SettingRepository implements SettingInterface
|
class SettingRepository implements SettingInterface
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface TeamsInterface
|
interface TeamsInterface
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Teams;
|
use App\Models\Teams;
|
||||||
use App\Repositories\Interface\TeamsInterface;
|
use App\Repositories\TeamsInterface;
|
||||||
|
|
||||||
class TeamsRepository implements TeamsInterface
|
class TeamsRepository implements TeamsInterface
|
||||||
{
|
{
|
||||||
|
12
app/Repositories/UserInterface.php
Normal file
12
app/Repositories/UserInterface.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\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, array $role);
|
||||||
|
}
|
39
app/Repositories/UserRepository.php
Normal file
39
app/Repositories/UserRepository.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\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 create(array $userDetails, array $role)
|
||||||
|
{
|
||||||
|
$user = User::create($userDetails);
|
||||||
|
$user->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();
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Videos;
|
use App\Models\Videos;
|
||||||
use App\Repositories\Interface\VideosInterface;
|
use App\Repositories\VideosInterface;
|
||||||
|
|
||||||
|
|
||||||
class VideoRepository implements VideosInterface
|
class VideoRepository implements VideosInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Repositories\Interface;
|
namespace App\Repositories;
|
||||||
|
|
||||||
interface VideosInterface
|
interface VideosInterface
|
||||||
{
|
{
|
@ -13,6 +13,7 @@
|
|||||||
"laravel/framework": "^10.10",
|
"laravel/framework": "^10.10",
|
||||||
"laravel/sanctum": "^3.2",
|
"laravel/sanctum": "^3.2",
|
||||||
"laravel/tinker": "^2.8",
|
"laravel/tinker": "^2.8",
|
||||||
|
"spatie/laravel-html": "^3.9",
|
||||||
"spatie/laravel-permission": "^6.7",
|
"spatie/laravel-permission": "^6.7",
|
||||||
"symfony/process": "^6.3",
|
"symfony/process": "^6.3",
|
||||||
"unisharp/laravel-filemanager": "^2.6"
|
"unisharp/laravel-filemanager": "^2.6"
|
||||||
|
80
composer.lock
generated
80
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "1393fa810c384d48b2c90249b5dca4c6",
|
"content-hash": "a05854bcfd7b9832b94b17acc7cb097d",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brian2694/laravel-toastr",
|
"name": "brian2694/laravel-toastr",
|
||||||
@ -3497,6 +3497,84 @@
|
|||||||
],
|
],
|
||||||
"time": "2023-11-08T05:53:05+00:00"
|
"time": "2023-11-08T05:53:05+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spatie/laravel-html",
|
||||||
|
"version": "3.9.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/spatie/laravel-html.git",
|
||||||
|
"reference": "35802bd9b276ce08e1d9d15584b17fdef965063b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/spatie/laravel-html/zipball/35802bd9b276ce08e1d9d15584b17fdef965063b",
|
||||||
|
"reference": "35802bd9b276ce08e1d9d15584b17fdef965063b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/http": "^10.0|^11.0",
|
||||||
|
"illuminate/support": "^10.0|^11.0",
|
||||||
|
"php": "^8.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.3",
|
||||||
|
"orchestra/testbench": "^8.0|^9.0",
|
||||||
|
"pestphp/pest": "^2.34"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Spatie\\Html\\HtmlServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Html": "Spatie\\Html\\Facades\\Html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Spatie\\Html\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sebastian De Deyne",
|
||||||
|
"email": "sebastian@spatie.be",
|
||||||
|
"homepage": "https://spatie.be",
|
||||||
|
"role": "Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Freek Van der Herten",
|
||||||
|
"email": "freek@spatie.be",
|
||||||
|
"homepage": "https://spatie.be",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A fluent html builder",
|
||||||
|
"homepage": "https://github.com/spatie/laravel-html",
|
||||||
|
"keywords": [
|
||||||
|
"html",
|
||||||
|
"spatie"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/spatie/laravel-html/tree/3.9.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://spatie.be/open-source/support-us",
|
||||||
|
"type": "custom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-04-25T08:07:39+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/laravel-permission",
|
"name": "spatie/laravel-permission",
|
||||||
"version": "6.7.0",
|
"version": "6.7.0",
|
||||||
|
@ -193,6 +193,7 @@ return [
|
|||||||
'aliases' => Facade::defaultAliases()->merge([
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
'Toastr' => Brian2694\Toastr\Facades\Toastr::class,
|
'Toastr' => Brian2694\Toastr\Facades\Toastr::class,
|
||||||
'Share' => Jorenvh\Share\ShareFacade::class,
|
'Share' => Jorenvh\Share\ShareFacade::class,
|
||||||
|
'Html' => Spatie\Html\Facades\Html::class,
|
||||||
])->toArray(),
|
])->toArray(),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
21
config/toastr.php
Normal file
21
config/toastr.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'options' => [
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
];
|
@ -0,0 +1,32 @@
|
|||||||
|
<?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::create('comments', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
};
|
141
public/hulaki/assets/css/custom.css
Normal file
141
public/hulaki/assets/css/custom.css
Normal file
@ -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;
|
||||||
|
}
|
@ -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
|
$('body').on('click', '.remove-item', function (e) {
|
||||||
let clone = content.cloneNode(true);
|
e.preventDefault();
|
||||||
container.appendChild(clone);
|
let url = $(this).data('link');
|
||||||
|
let id = $(this).data('id');
|
||||||
let progress = 1;
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
function loop() {
|
text: "You won't be able to revert this!",
|
||||||
if (mouseEntered === false) {
|
icon: 'warning',
|
||||||
progress = progress - speed;
|
showCancelButton: true,
|
||||||
}
|
confirmButtonColor: '#3085d6',
|
||||||
if (progress <= elWidth * -1) {
|
cancelButtonColor: '#d33',
|
||||||
progress = 0;
|
confirmButtonText: 'Yes, delete it!'
|
||||||
}
|
}).then((result) => {
|
||||||
container.style.transform = 'translateX(' + progress + 'px)';
|
if (result.isConfirmed) {
|
||||||
window.requestAnimationFrame(loop);
|
$.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() {
|
//initialize ckeditor
|
||||||
document.getElementById("mySidenav").style.width = "0";
|
document.querySelectorAll('.ckeditor-classic').forEach(editor => {
|
||||||
}
|
ClassicEditor
|
||||||
$(document).ready(function () {
|
.create(editor)
|
||||||
$('textarea#body').summernote({
|
.catch(error => {
|
||||||
height: '300px'
|
console.error(error);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
// 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() {
|
// //initialize select2
|
||||||
document.body.scrollTop = 0;
|
// $('.dropify').dropify();
|
||||||
document.documentElement.scrollTop = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//FOR SIDENAV DROPDOWN
|
// //initialize select2
|
||||||
$(".feat-btn").click(function () {
|
// $('.select2').select2();
|
||||||
$("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
|
// $('body').on('keyup', '.numeric', function () {
|
||||||
$(document).ready(function() {
|
// this.value = this.value.replace(/[^0-9\.]/g, '');
|
||||||
$('#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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// $(".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,
|
||||||
|
// });
|
||||||
|
69
resources/js/custom.js
Normal file
69
resources/js/custom.js
Normal file
@ -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,
|
||||||
|
});
|
@ -108,7 +108,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@role('admin')
|
@role('admin')
|
||||||
<li class="nav-item">
|
{{-- <li class="nav-item">
|
||||||
<a class="nav-link menu-link collapsed" href="#sidebarMenu4" data-bs-toggle="collapse"
|
<a class="nav-link menu-link collapsed" href="#sidebarMenu4" data-bs-toggle="collapse"
|
||||||
role="button" aria-expanded="false" aria-controls="sidebarMenu1">
|
role="button" aria-expanded="false" aria-controls="sidebarMenu1">
|
||||||
<i class="ri-pages-line"></i> <span data-key="t-pages">Users</span>
|
<i class="ri-pages-line"></i> <span data-key="t-pages">Users</span>
|
||||||
@ -120,6 +120,20 @@
|
|||||||
{{ CCMS::createMenuLink('Users', route('users.index')) }}
|
{{ CCMS::createMenuLink('Users', route('users.index')) }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</li> --}}
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link menu-link collapsed" href="#sidebarMenu4" data-bs-toggle="collapse"
|
||||||
|
role="button" aria-expanded="false" aria-controls="sidebarMenu1">
|
||||||
|
<i class="ri-pages-line"></i> <span data-key="t-pages">Users</span>
|
||||||
|
</a>
|
||||||
|
<div class="collapse menu-dropdown" id="sidebarMenu4">
|
||||||
|
<ul class="nav nav-sm flex-column">
|
||||||
|
{{ CCMS::createMenuLink('Roles', route('role.index')) }}
|
||||||
|
{{ CCMS::createMenuLink('Permissions', route('permissions.index')) }}
|
||||||
|
{{ CCMS::createMenuLink('Users', route('user.index')) }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@endrole
|
@endrole
|
||||||
|
|
||||||
@ -131,6 +145,7 @@
|
|||||||
{{ CCMS::createMenuLink('Artilces', route('articles.index')) }}
|
{{ CCMS::createMenuLink('Artilces', route('articles.index')) }}
|
||||||
{{ CCMS::createMenuLink('Teams', route('teams.index')) }}
|
{{ CCMS::createMenuLink('Teams', route('teams.index')) }}
|
||||||
{{ CCMS::createMenuLink('Popup', route('popups.index')) }}
|
{{ CCMS::createMenuLink('Popup', route('popups.index')) }}
|
||||||
|
{{ CCMS::createMenuLink('Comments', route('comments.index')) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,241 +1,247 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-layout="vertical" data-topbar="light" data-sidebar="dark" data-sidebar-size="lg"
|
<html lang="en" data-layout="vertical" data-topbar="light" data-sidebar="dark" data-sidebar-size="lg"
|
||||||
data-sidebar-image="none" data-preloader="disable">
|
data-sidebar-image="none" data-preloader="disable">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>{{ config('app.name') }} - Admin Dashboard </title>
|
<title>{{ config('app.name') }} - Admin Dashboard </title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta content="{{ config('app.name') }} - Admin & Dashboard" name="description" />
|
<meta content="{{ config('app.name') }} - Admin & Dashboard" name="description" />
|
||||||
<meta content="Bibhuti" name="author" />
|
<meta content="Bibhuti" name="author" />
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<script>
|
<script>
|
||||||
window.appUrl = "{{ env('APP_URL') }}";
|
window.appUrl = "{{ env('APP_URL') }}";
|
||||||
var route_prefix = "{{ env('APP_URL') }}/files";
|
var route_prefix = "{{ env('APP_URL') }}/files";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- App favicon -->
|
<!-- App favicon -->
|
||||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||||
|
|
||||||
<link rel="shortcut icon" href="{{ asset('assets/images/favicon.ico') }}">
|
<link rel="shortcut icon" href="{{ asset('assets/images/favicon.ico') }}">
|
||||||
|
|
||||||
|
|
||||||
<!-- gridjs css -->
|
<!-- gridjs css -->
|
||||||
<link rel="stylesheet" href="{{ asset('assets/libs/gridjs/theme/mermaid.min.css') }}">
|
<link rel="stylesheet" href="{{ asset('assets/libs/gridjs/theme/mermaid.min.css') }}">
|
||||||
|
|
||||||
<!-- Layout config Js -->
|
<!-- Layout config Js -->
|
||||||
<script src="{{ asset('assets/js/layout.js') }}"></script>
|
<script src="{{ asset('assets/js/layout.js') }}"></script>
|
||||||
<!-- Bootstrap Css -->
|
<!-- Bootstrap Css -->
|
||||||
<link href="{{ asset('assets/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
|
<link href="{{ asset('assets/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
<!-- Icons Css -->
|
<!-- Icons Css -->
|
||||||
<link href="{{ asset('assets/css/icons.min.css') }}" rel="stylesheet" type="text/css" />
|
<link href="{{ asset('assets/css/icons.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
<!-- App Css-->
|
<!-- App Css-->
|
||||||
<link href="{{ asset('assets/css/app.min.css') }}" rel="stylesheet" type="text/css" />
|
<link href="{{ asset('assets/css/app.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<!-- jsvectormap css -->
|
<!-- jsvectormap css -->
|
||||||
<link href="https://cdn.datatables.net/1.13.5/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
|
<link href="https://cdn.datatables.net/1.13.5/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="{{ asset('assets/libs/jsvectormap/css/jsvectormap.min.css') }}" rel="stylesheet" type="text/css" />
|
<link href="{{ asset('assets/libs/jsvectormap/css/jsvectormap.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="{{ asset('hulaki/assets/css/custom.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<!-- custom Css-->
|
<!-- custom Css-->
|
||||||
@stack('css')
|
@stack('css')
|
||||||
<link href="{{ asset('assets/css/custom.min.css') }}" rel="stylesheet" type="text/css" />
|
<link href="{{ asset('assets/css/custom.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
<style>
|
<style>
|
||||||
.auth-one-bg .bg-overlay {
|
.auth-one-bg .bg-overlay {
|
||||||
background: linear-gradient(to right, #bf2628, #b9070a);
|
background: linear-gradient(to right, #bf2628, #b9070a);
|
||||||
opacity: .9;
|
opacity: .9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="file-detail-show">
|
<body class="file-detail-show">
|
||||||
|
|
||||||
<!-- Begin page -->
|
<!-- Begin page -->
|
||||||
<div id="layout-wrapper">
|
<div id="layout-wrapper">
|
||||||
|
|
||||||
@include('backend.header')
|
@include('backend.header')
|
||||||
|
|
||||||
@include('backend.sidebar')
|
@include('backend.sidebar')
|
||||||
|
|
||||||
<div class="vertical-overlay"></div>
|
<div class="vertical-overlay"></div>
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
@yield('content')
|
@yield('content')
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="footer">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<script>
|
|
||||||
document.write(new Date().getFullYear())
|
|
||||||
</script> © {{ env('APP_NAME') }}.
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
|
||||||
<div class="text-sm-end d-none d-sm-block">
|
<footer class="footer">
|
||||||
Developed by <a href="https://www.bibhutisolutions.com/" target="_blank">Bibhuti Solutions Pvt. Ltd.</a>
|
<div class="container-fluid">
|
||||||
</div>
|
<div class="row">
|
||||||
</div>
|
<div class="col-sm-6">
|
||||||
</div>
|
<script>
|
||||||
|
document.write(new Date().getFullYear())
|
||||||
|
</script> © {{ env('APP_NAME') }}.
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="text-sm-end d-none d-sm-block">
|
||||||
|
Developed by <a href="https://www.bibhutisolutions.com/" target="_blank">Bibhuti
|
||||||
|
Solutions Pvt. Ltd.</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
<!-- end main content-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- end main content-->
|
<!-- END layout-wrapper -->
|
||||||
|
|
||||||
</div>
|
<!--start back-to-top-->
|
||||||
<!-- END layout-wrapper -->
|
<?php /*
|
||||||
|
|
||||||
<!--start back-to-top-->
|
|
||||||
<?php /*
|
|
||||||
@include("backend.parts.customizer")
|
@include("backend.parts.customizer")
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- JAVASCRIPT -->
|
<!-- JAVASCRIPT -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
|
<script src="{{ asset('assets/libs/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/libs/simplebar/simplebar.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/libs/node-waves/waves.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/libs/feather-icons/feather.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/pages/plugins/lord-icon-2.1.0.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/plugins.js') }}"></script>
|
||||||
|
|
||||||
<script src="{{ asset('assets/libs/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
<!-- apexcharts -->
|
||||||
<script src="{{ asset('assets/libs/simplebar/simplebar.min.js') }}"></script>
|
<script src="{{ asset('assets/libs/apexcharts/apexcharts.min.js') }}"></script>
|
||||||
<script src="{{ asset('assets/libs/node-waves/waves.min.js') }}"></script>
|
<script src="{{ asset('assets/js/pages/file-manager.init.js') }}"></script>
|
||||||
<script src="{{ asset('assets/libs/feather-icons/feather.min.js') }}"></script>
|
|
||||||
<script src="{{ asset('assets/js/pages/plugins/lord-icon-2.1.0.js') }}"></script>
|
|
||||||
<script src="{{ asset('assets/js/plugins.js') }}"></script>
|
|
||||||
|
|
||||||
<!-- apexcharts -->
|
<!-- App js -->
|
||||||
<script src="{{ asset('assets/libs/apexcharts/apexcharts.min.js') }}"></script>
|
<script src="{{ asset('assets/js/app.js') }}"></script>
|
||||||
<script src="{{ asset('assets/js/pages/file-manager.init.js') }}"></script>
|
<script src="{{ asset('vendor/laravel-filemanager/js/stand-alone-button.js') }}"></script>
|
||||||
|
<script src="{{ asset('hulaki/assets/js/custom.js') }}"></script>
|
||||||
|
|
||||||
<!-- App js -->
|
<!-- Vector map-->
|
||||||
<script src="{{ asset('assets/js/app.js') }}"></script>
|
<script src="{{ asset('assets/libs/jsvectormap/js/jsvectormap.min.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/laravel-filemanager/js/stand-alone-button.js') }}"></script>
|
<script src="{{ asset('assets/libs/jsvectormap/maps/world-merc.js') }}"></script>
|
||||||
|
|
||||||
<!-- Vector map-->
|
<!-- gridjs js -->
|
||||||
<script src="{{ asset('assets/libs/jsvectormap/js/jsvectormap.min.js') }}"></script>
|
<script src="{{ asset('assets/libs/gridjs/gridjs.umd.js') }}"></script>
|
||||||
<script src="{{ asset('assets/libs/jsvectormap/maps/world-merc.js') }}"></script>
|
|
||||||
|
|
||||||
<!-- gridjs js -->
|
|
||||||
<script src="{{ asset('assets/libs/gridjs/gridjs.umd.js') }}"></script>
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/toastify-js'></script>
|
||||||
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/toastify-js'></script>
|
<script type='text/javascript' src='https://choices-js.github.io/Choices/assets/scripts/choices.js'></script>
|
||||||
<script type='text/javascript' src='https://choices-js.github.io/Choices/assets/scripts/choices.js'></script>
|
<script src='https://cdn.jsdelivr.net/npm/flatpickr'></script>
|
||||||
<script src='https://cdn.jsdelivr.net/npm/flatpickr'></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.14.0/Sortable.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.14.0/Sortable.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.10.0/dist/js/bootstrap-datepicker.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.10.0/dist/js/bootstrap-datepicker.min.js"></script>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.10.0/dist/css/bootstrap-datepicker3.min.css"
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.10.0/dist/css/bootstrap-datepicker3.min.css"
|
rel="stylesheet">
|
||||||
rel="stylesheet">
|
<!-- JAVASCRIPT -->
|
||||||
<!-- JAVASCRIPT -->
|
|
||||||
|
|
||||||
<!-- <script src="https://cdn.ckeditor.com/ckeditor5/38.1.1/classic/ckeditor.js"></script> -->
|
<!-- <script src="https://cdn.ckeditor.com/ckeditor5/38.1.1/classic/ckeditor.js"></script> -->
|
||||||
<script src="https://cdn.ckeditor.com/4.16.2/full/ckeditor.js"></script>
|
<script src="https://cdn.ckeditor.com/4.16.2/full/ckeditor.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
var baseUrl = '{{ env('APP_URL') }}'; // Replace with your base URL
|
var baseUrl = '{{ env('APP_URL') }}'; // Replace with your base URL
|
||||||
|
|
||||||
var textareas = document.querySelectorAll('.ckeditor-classic');
|
var textareas = document.querySelectorAll('.ckeditor-classic');
|
||||||
for (var i = 0; i < textareas.length; i++) {
|
for (var i = 0; i < textareas.length; i++) {
|
||||||
CKEDITOR.replace(textareas[i], {
|
CKEDITOR.replace(textareas[i], {
|
||||||
// height: 100,
|
// height: 100,
|
||||||
filebrowserImageBrowseUrl: baseUrl + '/files?type=Images',
|
filebrowserImageBrowseUrl: baseUrl + '/files?type=Images',
|
||||||
filebrowserImageUploadUrl: baseUrl + '/files/upload?type=Images&_token={{ csrf_token() }}',
|
filebrowserImageUploadUrl: baseUrl +
|
||||||
filebrowserBrowseUrl: baseUrl + '/files?type=Files',
|
'/files/upload?type=Images&_token={{ csrf_token() }}',
|
||||||
filebrowserUploadUrl: baseUrl + '/files/upload?type=Files&_token={{ csrf_token() }}',
|
filebrowserBrowseUrl: baseUrl + '/files?type=Files',
|
||||||
filebrowserImageUploadPath: '/storage/photos', // Adjust the path as per your requirements
|
filebrowserUploadUrl: baseUrl + '/files/upload?type=Files&_token={{ csrf_token() }}',
|
||||||
filebrowserUploadPath: '/storage/files', // Adjust the path as per your requirements
|
filebrowserImageUploadPath: '/storage/photos', // Adjust the path as per your requirements
|
||||||
baseHref: baseUrl + '/', // Set the baseHref to the baseUrl
|
filebrowserUploadPath: '/storage/files', // Adjust the path as per your requirements
|
||||||
filebrowserImageBrowseCallback: function(url) {
|
baseHref: baseUrl + '/', // Set the baseHref to the baseUrl
|
||||||
var relativePath = url.replace(baseUrl + '/', '');
|
filebrowserImageBrowseCallback: function(url) {
|
||||||
alert("COW");
|
var relativePath = url.replace(baseUrl + '/', '');
|
||||||
onSelectFile(relativePath); // Call your custom function with the relative path
|
alert("COW");
|
||||||
}
|
onSelectFile(relativePath); // Call your custom function with the relative path
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function onSelectFile(url) {
|
function onSelectFile(url) {
|
||||||
// Use the relative path as needed
|
// Use the relative path as needed
|
||||||
console.log(url);
|
console.log(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
format: 'yyyy-mm-dd',
|
format: 'yyyy-mm-dd',
|
||||||
autoclose: true
|
autoclose: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// $('#lfm').filemanager('image', {prefix: route_prefix});
|
// $('#lfm').filemanager('image', {prefix: route_prefix});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var lfm = function(id, type, options) {
|
var lfm = function(id, type, options) {
|
||||||
let button = document.getElementById(id);
|
let button = document.getElementById(id);
|
||||||
|
|
||||||
button.addEventListener('click', function() {
|
button.addEventListener('click', function() {
|
||||||
var route_prefix = (options && options.prefix) ? options.prefix : '/filemanager';
|
var route_prefix = (options && options.prefix) ? options.prefix : '/filemanager';
|
||||||
var target_input = document.getElementById(button.getAttribute('data-input'));
|
var target_input = document.getElementById(button.getAttribute('data-input'));
|
||||||
var target_preview = document.getElementById(button.getAttribute('data-preview'));
|
var target_preview = document.getElementById(button.getAttribute('data-preview'));
|
||||||
var multiple_selection = (options && options.multi_selection) ? options.multi_selection : false;
|
var multiple_selection = (options && options.multi_selection) ? options.multi_selection : false;
|
||||||
// alert(multiple_selection);
|
// alert(multiple_selection);
|
||||||
window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager', 'width=900,height=600');
|
window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager',
|
||||||
window.SetUrl = function(items) {
|
'width=900,height=600');
|
||||||
var file_path = items.map(function(item) {
|
window.SetUrl = function(items) {
|
||||||
return item.url;
|
var file_path = items.map(function(item) {
|
||||||
}).join(',');
|
return item.url;
|
||||||
|
}).join(',');
|
||||||
|
|
||||||
// set the value of the desired input to image url
|
// set the value of the desired input to image url
|
||||||
target_input.value = file_path;
|
target_input.value = file_path;
|
||||||
target_input.dispatchEvent(new Event('change'));
|
target_input.dispatchEvent(new Event('change'));
|
||||||
|
|
||||||
// clear previous preview
|
// clear previous preview
|
||||||
target_preview.innerHtml = '';
|
target_preview.innerHtml = '';
|
||||||
|
|
||||||
// set or change the preview image src
|
// set or change the preview image src
|
||||||
items.forEach(function(item) {
|
items.forEach(function(item) {
|
||||||
let img = document.createElement('img')
|
let img = document.createElement('img')
|
||||||
img.setAttribute('style', 'height: 5rem')
|
img.setAttribute('style', 'height: 5rem')
|
||||||
img.setAttribute('src', item.thumb_url)
|
img.setAttribute('src', item.thumb_url)
|
||||||
if (!multiple_selection) target_preview.innerHTML = '';
|
if (!multiple_selection) target_preview.innerHTML = '';
|
||||||
target_preview.appendChild(img);
|
target_preview.appendChild(img);
|
||||||
});
|
});
|
||||||
|
|
||||||
// trigger change event
|
// trigger change event
|
||||||
target_preview.dispatchEvent(new Event('change'));
|
target_preview.dispatchEvent(new Event('change'));
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
</script>
|
||||||
};
|
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
</script>
|
<script>
|
||||||
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
// When the document is ready
|
||||||
<script>
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// When the document is ready
|
let success = "{{ Session::pull('success', '') }}";
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
let success = "{{ Session::pull('success', '') }}";
|
|
||||||
|
|
||||||
// If there is a success message in the session data
|
// If there is a success message in the session data
|
||||||
if (success !== '') {
|
if (success !== '') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
text: success
|
text: success
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
</script>
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@if (isset($GLOBALS['scripts']))
|
@if (isset($GLOBALS['scripts']))
|
||||||
{!! implode(PHP_EOL, $GLOBALS['scripts']) !!}
|
{!! implode(PHP_EOL, $GLOBALS['scripts']) !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@stack('js')
|
@stack('js')
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
6
resources/views/components/form-buttons.blade.php
Normal file
6
resources/views/components/form-buttons.blade.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@props(['editable' => false, 'label' => 'Add', 'href' => '#'])
|
||||||
|
|
||||||
|
<div class="text-end">
|
||||||
|
{{ html()->a($href = $href, $text = 'Cancel')->class('btn btn-danger') }}
|
||||||
|
{{ html()->button($editable ? 'Update' : $label, 'submit')->class('btn btn-success') }}
|
||||||
|
</div>
|
29
resources/views/crud/generated/comments/create.blade.php
Normal file
29
resources/views/crud/generated/comments/create.blade.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@extends('backend.template')
|
||||||
|
@section('content')
|
||||||
|
<div class='card'>
|
||||||
|
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||||
|
<h2 class="">{{ label('Add Comment') }}</h2>
|
||||||
|
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('comments.index')); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class='card-body'>
|
||||||
|
<form action="{{ route('comments.store') }}" id="storeCustomForm" method="POST">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_comments', 'content', 'id', '', 'Parent Id', 'parent_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_users', 'name', 'id', '', 'Users Id', 'users_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_news', 'title', 'news_id', '', 'News Id', 'news_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 pb-3"> {{createPlainTextArea('content', 'content', 'Content')}}</div> <br>
|
||||||
|
<div class="col-md-12"><?php createButton('btn-primary btn-store', '', 'Submit'); ?>
|
||||||
|
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('comments.index')); ?>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
30
resources/views/crud/generated/comments/edit.blade.php
Normal file
30
resources/views/crud/generated/comments/edit.blade.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
@extends('backend.template')
|
||||||
|
@section('content')
|
||||||
|
<div class='card'>
|
||||||
|
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||||
|
<h2 class="">{{ label('Edit Comment') }}</h2>
|
||||||
|
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('comments.index')); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class='card-body'>
|
||||||
|
<form action="{{ route('comments.update', [$data->id]) }}" id="updateCustomForm" method="POST">
|
||||||
|
@csrf <input type=hidden name='id' value='{{ $data->id }}' />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_comments', 'content', 'id', $data->parent_id, 'Parent Id', 'parent_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_users', 'name', 'id', $data->users_id, 'Users Id', 'users_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
{{ createCustomSelect('tbl_news', 'title', 'news_id', $data->news_id, 'News Id', 'news_id', 'form-control select2', 'status<>-1') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 pb-3"> {{ createPlainTextArea('content', '', 'Content', $data->content) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||||
|
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('comments.index')); ?>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
244
resources/views/crud/generated/comments/index.blade.php
Normal file
244
resources/views/crud/generated/comments/index.blade.php
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
@extends('backend.template')
|
||||||
|
@section('content')
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
|
<h2>{{ label('Comments List') }}</h2>
|
||||||
|
<a href="{{ route('comments.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table dataTable" id="tbl_comments" data-url="{{ route('comments.sort') }}">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||||
|
<th class="tb-col"><span class="overline-title">{{ label('Parent') }}</span></th>
|
||||||
|
<th class="tb-col"><span class="overline-title">{{ label('users') }}</span></th>
|
||||||
|
<th class="tb-col"><span class="overline-title">{{ label('news') }}</span></th>
|
||||||
|
<th class="tb-col"><span class="overline-title">{{ label('content') }}</span></th>
|
||||||
|
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@php
|
||||||
|
$i = 1;
|
||||||
|
@endphp
|
||||||
|
@foreach ($data as $item)
|
||||||
|
<tr data-id="{{ $item->id }}"
|
||||||
|
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||||
|
<td class="tb-col">{{ $i++ }}</td>
|
||||||
|
<td class="tb-col">
|
||||||
|
{!! getFieldData('tbl_comments', 'content', 'id', $item->parent_id) !!}
|
||||||
|
</td>
|
||||||
|
<td class="tb-col">
|
||||||
|
{!! getFieldData('tbl_users', 'name', 'id', $item->users_id) !!}
|
||||||
|
</td>
|
||||||
|
<td class="tb-col">
|
||||||
|
{!! getFieldData('tbl_news', 'title', 'news_id', $item->news_id) !!}
|
||||||
|
</td>
|
||||||
|
<td class="tb-col">{{ $item->content }}</td>
|
||||||
|
<td class="tb-col">
|
||||||
|
<div class="dropdown d-inline-block">
|
||||||
|
<button class="btn btn-soft-secondary btn-sm dropdown" type="button"
|
||||||
|
data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="ri-more-fill align-middle"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
|
<li><a href="{{ route('comments.show', [$item->id]) }}" class="dropdown-item"><i
|
||||||
|
class="ri-eye-fill align-bottom me-2 text-muted"></i>
|
||||||
|
{{ label('View') }}</a></li>
|
||||||
|
<li><a href="{{ route('comments.edit', [$item->id]) }}"
|
||||||
|
class="dropdown-item edit-item-btn"><i
|
||||||
|
class="ri-pencil-fill align-bottom me-2 text-muted"></i>
|
||||||
|
{{ label('Edit') }}</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('comments.toggle', [$item->id]) }}"
|
||||||
|
class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
|
||||||
|
<i class="ri-article-fill align-bottom me-2 text-muted"></i>
|
||||||
|
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('comments.destroy', [$item->id]) }}"
|
||||||
|
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||||
|
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
||||||
|
{{ label('Delete') }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||||
|
@endpush
|
||||||
|
@push('js')
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(e) {
|
||||||
|
$('.change-alias-badge').on('click', function() {
|
||||||
|
var aliasWrapper = $(this).prev('.alias-wrapper');
|
||||||
|
var aliasSpan = aliasWrapper.find('.alias');
|
||||||
|
var aliasInput = aliasWrapper.find('.alias-input');
|
||||||
|
var isEditing = $(this).hasClass('editing');
|
||||||
|
aliasInput.toggleClass("d-none");
|
||||||
|
if (isEditing) {
|
||||||
|
// Update alias text and switch to non-editing state
|
||||||
|
var newAlias = aliasInput.val();
|
||||||
|
aliasSpan.text(newAlias);
|
||||||
|
aliasSpan.show();
|
||||||
|
aliasInput.hide();
|
||||||
|
$(this).removeClass('editing').text('Change Alias');
|
||||||
|
var articleId = $(aliasWrapper).data('id');
|
||||||
|
var ajaxUrl = "{{ route('comments.updatealias') }}";
|
||||||
|
var data = {
|
||||||
|
articleId: articleId,
|
||||||
|
newAlias: newAlias
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: ajaxUrl,
|
||||||
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Switch to editing state
|
||||||
|
aliasSpan.hide();
|
||||||
|
aliasInput.show().focus();
|
||||||
|
$(this).addClass('editing').text('Save Alias');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var mytable = $(".dataTable").DataTable({
|
||||||
|
ordering: true,
|
||||||
|
rowReorder: {
|
||||||
|
//selector: 'tr'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
var isRowReorderComplete = false;
|
||||||
|
|
||||||
|
mytable.on('row-reorder', function(e, diff, edit) {
|
||||||
|
isRowReorderComplete = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mytable.on('draw', function() {
|
||||||
|
if (isRowReorderComplete) {
|
||||||
|
var url = mytable.table().node().getAttribute('data-url');
|
||||||
|
var ids = mytable.rows().nodes().map(function(node) {
|
||||||
|
return $(node).data('id');
|
||||||
|
}).toArray();
|
||||||
|
|
||||||
|
console.log(ids);
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
id_order: ids
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
isRowReorderComplete = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function confirmDelete(url) {
|
||||||
|
event.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
|
text: 'You will not be able to recover this item!',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Delete',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
reverseButtons: true
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmToggle(url) {
|
||||||
|
event.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
|
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Proceed',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
reverseButtons: true
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'GET',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire('Error!', 'An error occurred.', 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
@ -3,14 +3,14 @@
|
|||||||
<div class='card'>
|
<div class='card'>
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||||
<h2><?php echo label('View Details'); ?></h2>
|
<h2><?php echo label('View Details'); ?></h2>
|
||||||
<?php createButton("btn-primary btn-cancel","","Back to List",route('users.index')); ?>
|
<?php createButton("btn-primary btn-cancel","","Back to List",route('comments.index')); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class='card-body'>
|
<div class='card-body'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p><b>Name : </b> <span>{{$data->name}}</span></p><p><b>Email : </b> <span>{{$data->email}}</span></p><p><b>Username : </b> <span>{{$data->username}}</span></p><p><b>Email Verified At : </b> <span>{{$data->email_verified_at}}</span></p><p><b>Password : </b> <span>{{$data->password}}</span></p><p><b>Role : </b> <span>{{$data->role}}</span></p><p><b>Remember Token : </b> <span>{{$data->remember_token}}</span></p><p><b>Status : </b> <span
|
<p><b>Parent Id : </b> <span>{{$data->parent_id}}</span></p><p><b>Users Id : </b> <span>{{$data->users_id}}</span></p><p><b>News Id : </b> <span>{{$data->news_id}}</span></p><p><b>Content : </b> <span>{{$data->content}}</span></p><p><b>Status : </b> <span
|
||||||
class="{{$data->status == 1 ? 'text-success' : 'text-danger'}}">{{$data->status == 1 ? 'Active' : 'Inactive'}}</span></p><div class="d-flex justify-content-between">
|
class="{{$data->status == 1 ? 'text-success' : 'text-danger'}}">{{$data->status == 1 ? 'Active' : 'Inactive'}}</span></p><div class="d-flex justify-content-between">
|
||||||
<div>
|
<div>
|
||||||
<p><b>Created On :</b> <span>{{$data->created_at}}</span></p>
|
<p><b>Created On :</b> <span>{{$data->created_at}}</span></p>
|
137
resources/views/crud/generated/partials/role/action.blade.php
Normal file
137
resources/views/crud/generated/partials/role/action.blade.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<div class="row gy-4">
|
||||||
|
|
||||||
|
<div class="col-lg-4">
|
||||||
|
{{ html()->label('Name')->class('form-label') }}
|
||||||
|
{{ html()->text('name')->class('form-control')->placeholder('Enter Role Name')->required() }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-4">
|
||||||
|
{{ html()->label('Guard Name')->class('form-label') }}
|
||||||
|
{{ html()->text('guard_name', 'web')->class('form-control')->isReadonly($readonly = true) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<div class="form-check form-switch form-switch-lg mt-3">
|
||||||
|
{{ html()->checkbox('all_permissions_check')->class('form-check-input')->id('all-check') }}
|
||||||
|
{{ html()->label('Select All')->class('form-check-label')->for('all-check') }}
|
||||||
|
</div>
|
||||||
|
{{ html()->p()->text('Enable all Permissions for this role')->class('fs-6 text-muted mt-1') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-2">
|
||||||
|
<x-form-buttons :editable=$editable label='Assign' />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@foreach ($permissionLists as $key => $permission)
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="form-check form-switch form-switch-custom form-switch-success mb-3">
|
||||||
|
<input class="form-check-input parent-switch" type="checkbox" role="switch" id="check_{{ $key }}">
|
||||||
|
<label class="form-check-label ms-2" for="{check_{$key}}">{{ Str::ucfirst($key) }}</label>
|
||||||
|
</div>
|
||||||
|
<fieldset class="rounded-2 p-3">
|
||||||
|
<legend class="fs-5">Permissions</legend>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
@foreach ($permission as $index => $item)
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="form-check form-check-success">
|
||||||
|
{{ 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') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script type="text/javascript">
|
||||||
|
// $(document).ready(function() {
|
||||||
|
|
||||||
|
// // Cache selectors
|
||||||
|
// const childCheckboxes = $('.child-checkbox');
|
||||||
|
// const parentSwitches = $('.parent-switch');
|
||||||
|
// const allCheck = $('#all-check');
|
||||||
|
|
||||||
|
// // Initial selection (optional, can be removed if not needed)
|
||||||
|
// childCheckboxes.trigger('change');
|
||||||
|
|
||||||
|
// // Parent switch and child checkbox change handler (combined)
|
||||||
|
// $('.child-checkbox, .parent-switch').change(function() {
|
||||||
|
// const currentCol = $(this).closest('.col-lg-4');
|
||||||
|
// const currentSwitch = currentCol.find('.parent-switch');
|
||||||
|
// const currentChildren = currentCol.find(childCheckboxes);
|
||||||
|
|
||||||
|
// let allChecked = true;
|
||||||
|
// currentChildren.each(function() {
|
||||||
|
// if (!$(this).prop('checked')) {
|
||||||
|
// allChecked = false;
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// currentSwitch.prop('checked', allChecked);
|
||||||
|
// allCheck.prop('checked', childCheckboxes.prop(
|
||||||
|
// 'checked')); // Check all checkbox state
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // "all-check" change handler
|
||||||
|
// allCheck.change(function() {
|
||||||
|
// childCheckboxes.prop('checked', this.checked).trigger('change');
|
||||||
|
// });
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('.child-checkbox').trigger('change');
|
||||||
|
|
||||||
|
$('.parent-switch').change(function() {
|
||||||
|
let childCheckboxes = $(this).closest('.col-lg-4').find('.child-checkbox');
|
||||||
|
childCheckboxes.prop('checked', this.checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.child-checkbox').change(function() {
|
||||||
|
let parentSwitch = $(this).closest('.col-lg-4').find('.parent-switch');
|
||||||
|
let childCheckboxes = $(this).closest('.col-lg-4').find('.child-checkbox');
|
||||||
|
let allChecked = true;
|
||||||
|
childCheckboxes.each(function() {
|
||||||
|
if (!$(this).prop('checked')) {
|
||||||
|
allChecked = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
parentSwitch.prop('checked', allChecked);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#all-check').change(function() {
|
||||||
|
let childCheckboxes = $('.child-checkbox');
|
||||||
|
childCheckboxes.prop('checked', this.checked);
|
||||||
|
|
||||||
|
childCheckboxes.prop('checked', this.checked).trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.child-checkbox, .parent-switch').change(function() {
|
||||||
|
let allCheck = $('#all-check');
|
||||||
|
let childCheckboxes = $('.child-checkbox');
|
||||||
|
let allChecked = true;
|
||||||
|
|
||||||
|
childCheckboxes.each((index, checkBox) => {
|
||||||
|
if (!$(checkBox).prop('checked')) {
|
||||||
|
allChecked = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
allCheck.prop('checked', allChecked);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
17
resources/views/crud/generated/partials/role/view.blade.php
Normal file
17
resources/views/crud/generated/partials/role/view.blade.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalgridLabel">View User</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
|
||||||
|
@csrf
|
||||||
|
@include('crud.generated.partials.user.action', ['btnType' => 'View'])
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
<div class="row gy-4">
|
||||||
|
|
||||||
|
{{-- <div class="col-md-4">
|
||||||
|
{{ 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') }}
|
||||||
|
</div> --}}
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
{{ 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') }}
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<x-form-buttons :editable="$editable" label="Add" href="{{ route('user.index') }}" />
|
||||||
|
|
||||||
|
</div>
|
17
resources/views/crud/generated/partials/user/view.blade.php
Normal file
17
resources/views/crud/generated/partials/user/view.blade.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalgridLabel">View User</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
|
||||||
|
@csrf
|
||||||
|
@include('crud.generated.partials.user.action')
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
122
resources/views/crud/generated/permissions/action.blade.php
Normal file
122
resources/views/crud/generated/permissions/action.blade.php
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<div class="row gy-4">
|
||||||
|
|
||||||
|
@foreach ($permissionLists as $key => $permission)
|
||||||
|
{{-- @dd($permissionLists); --}}
|
||||||
|
<div class="col-lg-4">
|
||||||
|
{{-- <p class="justify-center text-soft-success"> --}}
|
||||||
|
<div class="form-check form-switch form-switch-custom form-switch-success mb-3">
|
||||||
|
{{-- <input class="form-check-input parent-switch" type="checkbox" role="switch" id="check_{{ $key }}"> --}}
|
||||||
|
<label class="form-check-label ms-2" for="{check_{$key}}">{{ Str::ucfirst($key) }}</label>
|
||||||
|
</div>
|
||||||
|
{{-- {{ Str::ucfirst($key) }}
|
||||||
|
</p> --}}
|
||||||
|
<fieldset class="rounded-2 p-3">
|
||||||
|
<legend class="fs-5">Permissions</legend>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
@foreach ($permission as $index => $item)
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="form-check form-check-success">
|
||||||
|
{{-- {{ html()->checkbox('permissions[]')->id('permission_' . $index)->value($index)->class('form-check-input child-checkbox')->checked($editable && in_array($index, $permissionIDsArray)) }} --}}
|
||||||
|
<a href="javascript:void(0);"
|
||||||
|
data-link="{{ route('permissions.destroy', $index) }}"
|
||||||
|
data-id="{{ $index }}"
|
||||||
|
class="link-danger fs-15 remove-item-btn"><i
|
||||||
|
class="ri-delete-bin-line"></i></a>
|
||||||
|
{{ html()->label(Str::ucfirst($item))->for('permission_' . $index)->class('form-check-label ms-2') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script type="text/javascript">
|
||||||
|
// $(document).ready(function() {
|
||||||
|
|
||||||
|
// // Cache selectors
|
||||||
|
// const childCheckboxes = $('.child-checkbox');
|
||||||
|
// const parentSwitches = $('.parent-switch');
|
||||||
|
// const allCheck = $('#all-check');
|
||||||
|
|
||||||
|
// // Initial selection (optional, can be removed if not needed)
|
||||||
|
// childCheckboxes.trigger('change');
|
||||||
|
|
||||||
|
// // Parent switch and child checkbox change handler (combined)
|
||||||
|
// $('.child-checkbox, .parent-switch').change(function() {
|
||||||
|
// const currentCol = $(this).closest('.col-lg-4');
|
||||||
|
// const currentSwitch = currentCol.find('.parent-switch');
|
||||||
|
// const currentChildren = currentCol.find(childCheckboxes);
|
||||||
|
|
||||||
|
// let allChecked = true;
|
||||||
|
// currentChildren.each(function() {
|
||||||
|
// if (!$(this).prop('checked')) {
|
||||||
|
// allChecked = false;
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// currentSwitch.prop('checked', allChecked);
|
||||||
|
// allCheck.prop('checked', childCheckboxes.prop(
|
||||||
|
// 'checked')); // Check all checkbox state
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // "all-check" change handler
|
||||||
|
// allCheck.change(function() {
|
||||||
|
// childCheckboxes.prop('checked', this.checked).trigger('change');
|
||||||
|
// });
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('.child-checkbox').trigger('change');
|
||||||
|
|
||||||
|
$('.parent-switch').change(function() {
|
||||||
|
let childCheckboxes = $(this).closest('.col-lg-4').find('.child-checkbox');
|
||||||
|
childCheckboxes.prop('checked', this.checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.child-checkbox').change(function() {
|
||||||
|
let parentSwitch = $(this).closest('.col-lg-4').find('.parent-switch');
|
||||||
|
let childCheckboxes = $(this).closest('.col-lg-4').find('.child-checkbox');
|
||||||
|
let allChecked = true;
|
||||||
|
childCheckboxes.each(function() {
|
||||||
|
if (!$(this).prop('checked')) {
|
||||||
|
allChecked = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
parentSwitch.prop('checked', allChecked);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#all-check').change(function() {
|
||||||
|
let childCheckboxes = $('.child-checkbox');
|
||||||
|
childCheckboxes.prop('checked', this.checked);
|
||||||
|
|
||||||
|
childCheckboxes.prop('checked', this.checked).trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.child-checkbox, .parent-switch').change(function() {
|
||||||
|
let allCheck = $('#all-check');
|
||||||
|
let childCheckboxes = $('.child-checkbox');
|
||||||
|
let allChecked = true;
|
||||||
|
|
||||||
|
childCheckboxes.each((index, checkBox) => {
|
||||||
|
if (!$(checkBox).prop('checked')) {
|
||||||
|
allChecked = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
allCheck.prop('checked', allChecked);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
@ -1,17 +0,0 @@
|
|||||||
@extends('backend.template')
|
|
||||||
@section('content')
|
|
||||||
<div class='card'>
|
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
|
||||||
<h2 class="">{{ label('Add Permissions') }}</h2>
|
|
||||||
<?php createButton("btn-primary btn-cancel","","Cancel",route('permissions.index')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='card-body'>
|
|
||||||
<form action="{{route('permissions.store')}}" id="storeCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
<div class="row"><div class="col-lg-6">{{createText("name","name","Name")}}
|
|
||||||
</div><div class="col-lg-6">{{createText("guard_name","guard_name","Guard Name")}}
|
|
||||||
</div> <br> <div class="col-md-12"><?php createButton("btn-primary btn-store","","Submit"); ?>
|
|
||||||
<?php createButton("btn-primary btn-cancel","","Cancel",route('permissions.index')); ?>
|
|
||||||
</div> </form></div></div>
|
|
||||||
@endsection
|
|
@ -1,25 +0,0 @@
|
|||||||
@extends('backend.template')
|
|
||||||
@section('content')
|
|
||||||
<div class='card'>
|
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
|
||||||
<h2 class="">{{ label('Edit Permissions') }}</h2>
|
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('permissions.index')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='card-body'>
|
|
||||||
<form action="{{ route('permissions.update', [$data->id]) }}" id="updateCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
@method('PUT')
|
|
||||||
<input type=hidden name='id' value='{{ $data->id }}' />
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">{{ createText('name', 'name', 'Name', '', $data->name) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">{{ createText('guard_name', 'guard_name', 'Guard Name', '', $data->guard_name) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('permissions.index')); ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
@ -1,185 +1,59 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="card">
|
<div class="page-content">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="container-fluid">
|
||||||
<h2>{{ label('Permissions List') }}</h2>
|
|
||||||
<a href="{{ route('permissions.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table dataTable" id="tbl_permissions">
|
|
||||||
<thead class="table-light">
|
|
||||||
<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('guard_name') }}</span></th>
|
|
||||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('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 }}"
|
|
||||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
|
||||||
<td class="tb-col">{{ $i++ }}</td>
|
|
||||||
<td class="tb-col">{{ $item->name }}</td>
|
|
||||||
<td class="tb-col">{{ $item->guard_name }}</td>
|
|
||||||
<td class="tb-col">
|
|
||||||
<div class="dropdown d-inline-block">
|
|
||||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button"
|
|
||||||
data-bs-toggle="dropdown" aria-expanded="false">
|
|
||||||
<i class="ri-more-fill align-middle"></i>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
|
||||||
<li><a href="{{ route('permissions.show', [$item->id]) }}" class="dropdown-item"><i
|
|
||||||
class="ri-eye-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('View') }}</a></li>
|
|
||||||
<li><a href="{{ route('permissions.edit', [$item->id]) }}"
|
|
||||||
class="dropdown-item edit-item-btn"><i
|
|
||||||
class="ri-pencil-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Edit') }}</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ route('permissions.destroy', [$item->id]) }}"
|
|
||||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
|
||||||
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Delete') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
</li>
|
<div class="row">
|
||||||
</ul>
|
<div class="col-12">
|
||||||
</div>
|
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
<!-- end page title -->
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</tbody>
|
<div class="card">
|
||||||
</table>
|
<div class="card-header align-items-center d-flex">
|
||||||
|
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<a href="{{ route('permission.generatePermissionFromRoutes') }}"
|
||||||
|
class="btn btn-success waves-effect waves-light"><i
|
||||||
|
class="ri-add-fill me-1 align-bottom"></i>Generate Permissions</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
@include('crud.generated.permissions.action')
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('css')
|
@push('css')
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css" />
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.2/css/buttons.dataTables.min.css">
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
||||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
<script src="{{ asset('assets/js/pages/datatables.init.js') }}"></script>
|
||||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(e) {
|
|
||||||
var mytable = $(".dataTable").DataTable({
|
|
||||||
ordering: true,
|
|
||||||
rowReorder: {
|
|
||||||
//selector: 'tr'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
var isRowReorderComplete = false;
|
|
||||||
|
|
||||||
mytable.on('row-reorder', function(e, diff, edit) {
|
|
||||||
isRowReorderComplete = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
mytable.on('draw', function() {
|
|
||||||
if (isRowReorderComplete) {
|
|
||||||
var url = mytable.table().node().getAttribute('data-url');
|
|
||||||
var ids = mytable.rows().nodes().map(function(node) {
|
|
||||||
return $(node).data('id');
|
|
||||||
}).toArray();
|
|
||||||
|
|
||||||
console.log(ids);
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "POST",
|
|
||||||
headers: {
|
|
||||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id_order: ids
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
console.log(response);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
isRowReorderComplete = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function confirmDelete(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'You will not be able to recover this item!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Delete',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmToggle(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Proceed',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'GET',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
@extends('backend.template')
|
|
||||||
@section('content')
|
|
||||||
<div class='card'>
|
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
|
||||||
<h2><?php echo label('View Details'); ?></h2>
|
|
||||||
<?php createButton("btn-primary btn-cancel","","Back to List",route('permissions.index')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='card-body'>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p><b>Name : </b> <span>{{$data->name}}</span></p><p><b>Guard Name : </b> <span>{{$data->guard_name}}</span></p><div class="d-flex justify-content-between">
|
|
||||||
<div>
|
|
||||||
<p><b>Created On :</b> <span>{{$data->created_at}}</span></p>
|
|
||||||
<p><b>Created By :</b> <span>{{$data->createdBy}}</span></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p><b>Updated On :</b> <span>{{$data->updated_at}}</span></p>
|
|
||||||
<p><b>Updated By :</b> <span>{{$data->updatedBy}}</span></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@endSection
|
|
@ -1,34 +1,43 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class='card'>
|
<div class="page-content">
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
<div class="container-fluid">
|
||||||
<h2 class="">{{ label('Add Roles') }}</h2>
|
<!-- start page title -->
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('roles.index')); ?>
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('role.store') }}" class="needs-validation" novalidate method="post">
|
||||||
|
@csrf
|
||||||
|
@include('crud.generated.partials.role.action', ['btnType' => 'Save'])
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--end row-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class='card-body'>
|
<!-- container-fluid -->
|
||||||
<form action="{{ route('roles.store') }}" id="storeCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">{{ createText('name', 'name', 'Name') }}
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">{{ createText('guard_name', 'guard_name', 'Guard Name') }}
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 pb-3">
|
|
||||||
<label for='permission' class="form-label col-form-label"> Permission</label>
|
|
||||||
<select id="permission" name="permission" autocomplete="permission-name" class="form-select">
|
|
||||||
@foreach($permissions as $permission)
|
|
||||||
<option value="0"> Select Permission </option>
|
|
||||||
<option value="{{ $permission->name }}" >{{ $permission->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12"><?php createButton('btn-primary btn-store', '', 'Submit'); ?>
|
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('roles.index')); ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@ -1,69 +1,45 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="page-content">
|
||||||
<div class="card col-8">
|
<div class="container-fluid">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<!-- start page title -->
|
||||||
<h2>{{ __('Edit Roles') }}</h2>
|
<div class="row">
|
||||||
<a href="{{ route('roles.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
{{ html()->modelForm($role, 'PUT')->route('role.update', $role->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||||
|
|
||||||
<div class="card-body">
|
@include('crud.generated.partials.role.action', ['btnType' => 'Save'])
|
||||||
<form action="{{ route('roles.update', [$data->id]) }}" id="updateCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
@method('PUT')
|
|
||||||
|
|
||||||
<input type="hidden" name="id" value="{{ $data->id }}" />
|
{{ html()->closeModelForm() }}
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<label for="name" class="form-label">Name</label>
|
|
||||||
<input type="text" id="name" name="name" class="form-control"
|
|
||||||
value="{{ $data->name }}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<label for="guard_name" class="form-label">Guard Name</label>
|
|
||||||
<input type="text" id="guard_name" name="guard_name" class="form-control"
|
|
||||||
value="{{ $data->guard_name }}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-6 pb-3">
|
|
||||||
<label for="permission" class="form-label">Permission</label>
|
|
||||||
<select id="permission" name="permission" class="form-select">
|
|
||||||
<option value="0">Add Permissions</option>
|
|
||||||
@foreach ($permissions as $permission)
|
|
||||||
<option value="{{ $permission->name }}">{{ $permission->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<button type="submit" class="btn btn-primary btn-update">Submit</button>
|
|
||||||
<a href="{{ route('roles.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!--end row-->
|
||||||
|
|
||||||
<div class="card col-4">
|
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
|
||||||
<h4>{{ __('Roles with permissions') }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
@if ($data->permissions)
|
|
||||||
@foreach ($data->permissions as $role_permission)
|
|
||||||
<form class="d-inline-block" method="POST" action="{{route('roles.permissions.revoke',[$data->id,$role_permission->id])}}"
|
|
||||||
onsubmit="return confirm('Are you sure?');">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-danger">{{ $role_permission->name }}</button>
|
|
||||||
</form>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- container-fluid -->
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
@ -1,185 +1,66 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="card">
|
<div class="page-content">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="container-fluid">
|
||||||
<h2>{{ label('Roles List') }}</h2>
|
<div class="row">
|
||||||
<a href="{{ route('roles.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table dataTable" id="tbl_roles">
|
|
||||||
<thead class="table-light">
|
|
||||||
<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('guard_name') }}</span></th>
|
|
||||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('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 }}"
|
|
||||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
|
||||||
<td class="tb-col">{{ $i++ }}</td>
|
|
||||||
<td class="tb-col">{{ $item->name }}</td>
|
|
||||||
<td class="tb-col">{{ $item->guard_name }}</td>
|
|
||||||
<td class="tb-col">
|
|
||||||
<div class="dropdown d-inline-block">
|
|
||||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button"
|
|
||||||
data-bs-toggle="dropdown" aria-expanded="false">
|
|
||||||
<i class="ri-more-fill align-middle"></i>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
|
||||||
<li><a href="{{ route('roles.show', [$item->id]) }}" class="dropdown-item"><i
|
|
||||||
class="ri-eye-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('View') }}</a></li>
|
|
||||||
<li><a href="{{ route('roles.edit', [$item->id]) }}"
|
|
||||||
class="dropdown-item edit-item-btn"><i
|
|
||||||
class="ri-pencil-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Edit') }}</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ route('roles.destroy', [$item->id]) }}"
|
|
||||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
|
||||||
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Delete') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
</li>
|
<div class="col-lg-12">
|
||||||
</ul>
|
<div class="card">
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="card-header align-items-center d-flex">
|
||||||
|
<h5 class="card-title flex-grow-1 mb-0">Role Lists</h5>
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<a href="{{ route('role.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||||
|
class="ri-add-fill me-1 align-bottom"></i> Create Role</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
<div class="card-body">
|
||||||
</tr>
|
<div class="table-responsive">
|
||||||
@endforeach
|
<table id="buttons-datatables" class="display table-sm table-bordered table"
|
||||||
|
style="width:100%">
|
||||||
</tbody>
|
<thead class="table-light">
|
||||||
</table>
|
<tr>
|
||||||
|
<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">Guard</span></th>
|
||||||
|
<th class="tb-col" data-sortable="false"><span
|
||||||
|
class="overline-title">Action</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($roles as $index => $role)
|
||||||
|
<tr>
|
||||||
|
<td class="tb-col">{{ $index + 1 }}</td>
|
||||||
|
<td class="tb-col">{{ $role->name }}</td>
|
||||||
|
<td class="tb-col">{{ $role->guard_name }}</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" data-bs-target="#viewModal">
|
||||||
|
<i class="ri-eye-line"></i>
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('role.edit', $role->id) }}"
|
||||||
|
class="link-success fs-15 edit-item-btn"><i
|
||||||
|
class="ri-edit-2-line"></i></a>
|
||||||
|
|
||||||
|
<a href="javascript:void(0);"
|
||||||
|
data-link="{{ route('role.destroy', $role->id) }}"
|
||||||
|
data-id="{{ $role->id }}"
|
||||||
|
class="link-danger fs-15 remove-item"><i
|
||||||
|
class="ri-delete-bin-line"></i></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('css')
|
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
|
||||||
@endpush
|
|
||||||
@push('js')
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(e) {
|
|
||||||
var mytable = $(".dataTable").DataTable({
|
|
||||||
ordering: true,
|
|
||||||
rowReorder: {
|
|
||||||
//selector: 'tr'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
var isRowReorderComplete = false;
|
|
||||||
|
|
||||||
mytable.on('row-reorder', function(e, diff, edit) {
|
|
||||||
isRowReorderComplete = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
mytable.on('draw', function() {
|
|
||||||
if (isRowReorderComplete) {
|
|
||||||
var url = mytable.table().node().getAttribute('data-url');
|
|
||||||
var ids = mytable.rows().nodes().map(function(node) {
|
|
||||||
return $(node).data('id');
|
|
||||||
}).toArray();
|
|
||||||
|
|
||||||
console.log(ids);
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "POST",
|
|
||||||
headers: {
|
|
||||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id_order: ids
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
console.log(response);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
isRowReorderComplete = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function confirmDelete(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'You will not be able to recover this item!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Delete',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmToggle(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Proceed',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'GET',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
@extends('backend.template')
|
|
||||||
@section('content')
|
|
||||||
<div class='card'>
|
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
|
||||||
<h2><?php echo label('View Details'); ?></h2>
|
|
||||||
<?php createButton("btn-primary btn-cancel","","Back to List",route('roles.index')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='card-body'>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p><b>Name : </b> <span>{{$data->name}}</span></p><p><b>Guard Name : </b> <span>{{$data->guard_name}}</span></p><div class="d-flex justify-content-between">
|
|
||||||
<div>
|
|
||||||
<p><b>Created On :</b> <span>{{$data->created_at}}</span></p>
|
|
||||||
<p><b>Created By :</b> <span>{{$data->createdBy}}</span></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p><b>Updated On :</b> <span>{{$data->updated_at}}</span></p>
|
|
||||||
<p><b>Updated By :</b> <span>{{$data->updatedBy}}</span></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@endSection
|
|
@ -79,7 +79,7 @@
|
|||||||
{{ label('Edit') }}</a></li>
|
{{ label('Edit') }}</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ route('settings.destroy', [$item->setting_id]) }}"
|
<a href="{{ route('settings.destroy', [$item->setting_id]) }}"
|
||||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
class="dropdown-item remove-item" onclick="confirmDelete(this.href)">
|
||||||
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
||||||
{{ label('Delete') }}
|
{{ label('Delete') }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -1,25 +1,42 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')@section('content')
|
||||||
@section('content')
|
<div class="page-content">
|
||||||
<div class='card'>
|
<div class="container-fluid">
|
||||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
<!-- start page title -->
|
||||||
<h2 class="">{{ label('Add Users') }}</h2>
|
<div class="row">
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('users.index')); ?>
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='card-body'>
|
</div>
|
||||||
<form action="{{ route('users.store') }}" id="storeCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">{{ createText('name', 'name', 'Name') }}
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">{{ createText('email', 'email', 'Email') }}
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">{{ createText('username', 'username', 'Username') }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12"><?php createButton('btn-primary btn-store', '', 'Submit'); ?>
|
|
||||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('users.index')); ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
|
||||||
|
@csrf
|
||||||
|
@include('crud.generated.partials.user.action')
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--end row-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- container-fluid -->
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@ -1,100 +1,47 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="page-content">
|
||||||
<div class="col-lg-8">
|
<div class="container-fluid">
|
||||||
<div class="card">
|
<!-- start page title -->
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="row">
|
||||||
<h2>{{ __('Edit Users') }}</h2>
|
<div class="col-12">
|
||||||
<a href="{{ route('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||||
</div>
|
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||||
<div class="card-body">
|
|
||||||
<form action="{{ route('users.update', [$data->id]) }}" id="updateCustomForm" method="POST">
|
|
||||||
@csrf
|
|
||||||
@method('POST')
|
|
||||||
<input type="hidden" name="id" value="{{ $data->id }}" />
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6 mb-3">
|
|
||||||
<label for="name" class="form-label">Name</label>
|
|
||||||
<input type="text" id="name" name="name" class="form-control"
|
|
||||||
value="{{ $data->name }}">
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 mb-3">
|
|
||||||
<label for="email" class="form-label">Email</label>
|
|
||||||
<input type="email" id="email" name="email" class="form-control"
|
|
||||||
value="{{ $data->email }}">
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 mb-3">
|
|
||||||
<label for="role" class="form-label">Roles</label>
|
|
||||||
<select id="role" name="role" autocomplete="role" class="form-select">
|
|
||||||
<option value="0"> Add Roles </option>
|
|
||||||
@foreach ($roles as $role)
|
|
||||||
<option value="{{ $role->name }}">{{ $role->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-6 mb-3">
|
<div class="page-title-right">
|
||||||
<label for="permission" class="form-label">Permission</label>
|
<ol class="breadcrumb m-0">
|
||||||
<select id="permission" name="permission" autocomplete="permission-name"
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||||
class="form-select">
|
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||||
<option value="0"> Add Permission </option>
|
</ol>
|
||||||
@foreach ($permissions as $permission)
|
|
||||||
<option value="{{ $permission->name }}">{{ $permission->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12">
|
|
||||||
<button type="submit" class="btn btn-primary btn-update">Submit</button>
|
|
||||||
<a href="{{ route('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-4">
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h4>{{ __('Roles') }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
@if ($data->roles)
|
|
||||||
@foreach ($data->roles as $user_role)
|
|
||||||
<form class="d-inline-block" method="POST"
|
|
||||||
action="{{ route('users.roles.remove', [$data->id, $user_role->id]) }}"
|
|
||||||
onsubmit="return confirm('Are you sure?');">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-danger">{{ $user_role->name }}</button>
|
|
||||||
</form>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h4>{{ __('Permissions') }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
@if ($data->permissions)
|
|
||||||
@foreach ($data->permissions as $user_permission)
|
|
||||||
<form class="d-inline-block" method="POST"
|
|
||||||
action="{{ route('users.permissions.revoke', [$data->id, $user_permission->id]) }}"
|
|
||||||
onsubmit="return confirm('Are you sure?');">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-danger">{{ $user_permission->name }}</button>
|
|
||||||
</form>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
{{ html()->modelForm($user, 'PUT')->route('user.update', $user->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||||
|
|
||||||
|
@include('crud.generated.partials.user.action')
|
||||||
|
|
||||||
|
{{ html()->closeModelForm() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--end row-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- container-fluid -->
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@ -1,187 +1,80 @@
|
|||||||
@extends('backend.template')
|
@extends('backend.template')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="card">
|
<div class="page-content">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="container-fluid">
|
||||||
<h2>{{ label('Users List') }}</h2>
|
<div class="row">
|
||||||
{{-- <a href="{{ route('users.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a> --}}
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table dataTable" id="tbl_users">
|
|
||||||
<thead class="table-light">
|
|
||||||
<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('username') }}</span></th>
|
|
||||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('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 }}"
|
|
||||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
|
||||||
<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">
|
|
||||||
<div class="dropdown d-inline-block">
|
|
||||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button"
|
|
||||||
data-bs-toggle="dropdown" aria-expanded="false">
|
|
||||||
<i class="ri-more-fill align-middle"></i>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
|
||||||
<li><a href="{{ route('users.show', [$item->id]) }}" class="dropdown-item"><i
|
|
||||||
class="ri-eye-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('View') }}</a></li>
|
|
||||||
<li><a href="{{ route('users.edit', [$item->id]) }}"
|
|
||||||
class="dropdown-item edit-item-btn"><i
|
|
||||||
class="ri-pencil-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Edit') }}</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ route('users.destroy', [$item->id]) }}"
|
|
||||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
|
||||||
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i>
|
|
||||||
{{ label('Delete') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
</li>
|
<div class="col-lg-12">
|
||||||
</ul>
|
<div class="card">
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="card-header align-items-center d-flex">
|
||||||
|
<h5 class="card-title flex-grow-1 mb-0">User Lists</h5>
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<a href="{{ route('user.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||||
|
class="ri-add-fill me-1 align-bottom"></i> Create User</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
<div class="card-body">
|
||||||
</tr>
|
<div class="table-responsive">
|
||||||
@endforeach
|
<table id="buttons-datatables" class="display table-sm table-bordered table"
|
||||||
|
style="width:100%">
|
||||||
</tbody>
|
<thead class="table-light">
|
||||||
</table>
|
<tr>
|
||||||
|
<th class="tb-col"><span class="overline-title">S.N</span></th>
|
||||||
|
<th class="tb-col"><span class="overline-title">Username</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" data-sortable="false"><span
|
||||||
|
class="overline-title">Action</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($users as $index => $user)
|
||||||
|
<tr>
|
||||||
|
<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">
|
||||||
|
{{ $user->employee?->full_name }}
|
||||||
|
<p class="small text-muted">{{ $user->employee?->department?->name }}
|
||||||
|
</p>
|
||||||
|
</td> --}}
|
||||||
|
<td class="tb-col">{{ $user->roles?->first()?->name }}</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" data-bs-target="#viewModal">
|
||||||
|
<i class="ri-eye-line"></i>
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('user.edit', $user->id) }}"
|
||||||
|
class="link-success fs-15 edit-item-btn"><i
|
||||||
|
class="ri-edit-2-line"></i></a>
|
||||||
|
|
||||||
|
<a href="javascript:void(0);"
|
||||||
|
data-link="{{ route('user.destroy', $user->id) }}"
|
||||||
|
data-id="{{ $user->id }}"
|
||||||
|
class="link-danger fs-15 remove-item"><i
|
||||||
|
class="ri-delete-bin-line"></i></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@include('crud.generated.partials.user.view')
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('css')
|
@push('css')
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||||
@endpush
|
@endpush
|
||||||
@push('js')
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(e) {
|
|
||||||
var mytable = $(".dataTable").DataTable({
|
|
||||||
ordering: true,
|
|
||||||
rowReorder: {
|
|
||||||
//selector: 'tr'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
var isRowReorderComplete = false;
|
|
||||||
|
|
||||||
mytable.on('row-reorder', function(e, diff, edit) {
|
|
||||||
isRowReorderComplete = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
mytable.on('draw', function() {
|
|
||||||
if (isRowReorderComplete) {
|
|
||||||
var url = mytable.table().node().getAttribute('data-url');
|
|
||||||
var ids = mytable.rows().nodes().map(function(node) {
|
|
||||||
return $(node).data('id');
|
|
||||||
}).toArray();
|
|
||||||
|
|
||||||
console.log(ids);
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "POST",
|
|
||||||
headers: {
|
|
||||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id_order: ids
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
console.log(response);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
isRowReorderComplete = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function confirmDelete(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'You will not be able to recover this item!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Delete',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmToggle(url) {
|
|
||||||
event.preventDefault();
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Are you sure?',
|
|
||||||
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Proceed',
|
|
||||||
cancelButtonText: 'Cancel',
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: 'GET',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
Swal.fire('Error!', 'An error occurred.', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
|
@ -45,7 +45,11 @@
|
|||||||
<button type="submit">लगइन</button>
|
<button type="submit">लगइन</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="important-text">
|
<div class="important-text">
|
||||||
<p>खाता छैन? <a href="{{route('userRegister')}}">लगइन गर्नुहोस! </a></p>
|
<form action={{ route('userRegister') }} method="POST">
|
||||||
|
@csrf
|
||||||
|
{{-- @method('GET') --}}
|
||||||
|
<p>खाता छ? <a href="{{ route('userRegister') }}">रजिस्टर गर्नुहोस ! </a> </p>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="register-form">
|
<div class="register-form">
|
||||||
<h2>रजिस्टर</h2>
|
<h2>रजिस्टर</h2>
|
||||||
<form id="register-form" action={{ route('postresgistration') }}>
|
<form id="register-form" action={{ route('postRegistration') }}>
|
||||||
@csrf
|
@csrf
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>नाम</label>
|
<label>नाम</label>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<button type="submit">रजिस्टर गर्नुहोस</button>
|
<button type="submit">रजिस्टर गर्नुहोस</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="important-text">
|
<div class="important-text">
|
||||||
<p>खाता छ? <a href="{{route('postresgistration')}}">रजिस्टर गर्नुहोस !</a></p>
|
<p>खाता छ? <a href="{{route('postRegistration')}}">लगइन गर्नुहोस!</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
@extends('hulaki_khabar.layout.layout')
|
@extends('hulaki_khabar.layout.layout')
|
||||||
@section('meta')
|
@section('meta')
|
||||||
<meta property="og:title" content="{{ $news->title }}" />
|
<meta property="og:title" content="{{ $news->title }}" />
|
||||||
<meta property="og:description"
|
<meta property="og:description" content="{{ $news->title }}" />
|
||||||
content="{{ $news->title}}" />
|
|
||||||
<meta property="og:image" content="{{ asset($news->thumb) }}" />
|
<meta property="og:image" content="{{ asset($news->thumb) }}" />
|
||||||
@endsection
|
@endsection
|
||||||
@push('css')
|
@push('css')
|
||||||
@ -128,9 +127,110 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<div class="comments-area">
|
||||||
|
<h3 class="comments-title">२ कमेन्ट :</h3>
|
||||||
|
<ol class="comment-list">
|
||||||
|
@foreach ($newsWithComment as $comment)
|
||||||
|
@if ($comment->comments->isNotEmpty())
|
||||||
|
@foreach ($comment->comments as $item)
|
||||||
|
<li class="comment">
|
||||||
|
<div class="comment-body">
|
||||||
|
<footer class="comment-meta">
|
||||||
|
<div class="comment-author vcard">
|
||||||
|
<img src="https://templates.envytheme.com/depan/default/assets/img/client/client-1.jpg"
|
||||||
|
class="avatar" alt="image">
|
||||||
|
<b class="fn">{{ $item->user?->name }} </b>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<div class="comment-content">
|
||||||
|
<p>{{ $item->content }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@if ($item->subcomments)
|
||||||
|
<ol class="children">
|
||||||
|
@foreach ($item->subcomments as $subcomment)
|
||||||
|
<li class="comment">
|
||||||
|
<div class="comment-body">
|
||||||
|
<footer class="comment-meta">
|
||||||
|
<div class="comment-author vcard">
|
||||||
|
<img src="https://templates.envytheme.com/depan/default/assets/img/client/client-2.jpg"
|
||||||
|
class="avatar" alt="image">
|
||||||
|
<b class="fn">{{ $subcomment->user?->name }}</b>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<div class="comment-content">
|
||||||
|
<p>{{ $subcomment->content }}</p>
|
||||||
|
</div>
|
||||||
|
{{-- @if ($loop->last)
|
||||||
|
<div class="reply">
|
||||||
|
<form action="{{ route('comments.store') }}"
|
||||||
|
method="POST" id="comment">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name='news_id'
|
||||||
|
value="{{ $news->news_id }}">
|
||||||
|
<input type="hidden" name='users_id'
|
||||||
|
value="{{ auth()->user()->id }}">
|
||||||
|
<input type="hidden" name='parent_id'
|
||||||
|
value="{{ $item->id }}">
|
||||||
|
<textarea name="content"></textarea>
|
||||||
|
<input type="submit" value="Reply">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endif --}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ol>
|
||||||
|
@else
|
||||||
|
<div class="reply">
|
||||||
|
<form action="{{ route('comments.store') }}" method="POST" id="comment">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name='news_id' value="{{ $news->news_id }}">
|
||||||
|
<input type="hidden" name='users_id' value="{{ auth()->user()->id }}">
|
||||||
|
<input type="hidden" name='parent_id' value="{{ $item->id }}">
|
||||||
|
<textarea name="content"></textarea>
|
||||||
|
<input type="submit" value="Reply">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="reply">
|
||||||
|
<form action="{{ route('comments.store') }}"
|
||||||
|
method="POST" id="comment">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name='news_id'
|
||||||
|
value="{{ $news->news_id }}">
|
||||||
|
<input type="hidden" name='users_id'
|
||||||
|
value="{{ auth()->user()->id }}">
|
||||||
|
<input type="hidden" name='parent_id'
|
||||||
|
value="{{ $item->id }}">
|
||||||
|
<textarea name="content"></textarea>
|
||||||
|
<input type="submit" value="Reply">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<div class="reply">
|
||||||
|
<form action="{{ route('comments.store') }}" method="POST" id="comment">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name='news_id' value="{{ $news->news_id }}">
|
||||||
|
<input type="hidden" name='users_id' value="{{ auth()->user()->id }}">
|
||||||
|
{{-- <input type="hidden" name='parent_id' value="{{ $item->id }}"> --}}
|
||||||
|
<textarea name="content"></textarea>
|
||||||
|
<input type="submit" value="Reply">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-3" id="sidebar">
|
<div class="col-lg-3" id="sidebar">
|
||||||
<aside class="widget-area mt-50">
|
<aside class="widget-area mt-50">
|
||||||
<section class="widget widget_featured_reports">
|
<section class="widget widget_featured_reports">
|
||||||
@ -155,12 +255,6 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</section>
|
</section>
|
||||||
</div><br>
|
</div><br>
|
||||||
|
|
||||||
{{-- <section class="widget widget_featured_reports">
|
|
||||||
<img src="{{ asset('hulaki/assets/img/ad/prabhu_pay_onlinekhabar.gif') }}" alt="image"
|
|
||||||
class="img-fluid">
|
|
||||||
</section> --}}
|
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -168,3 +262,20 @@
|
|||||||
</section>
|
</section>
|
||||||
<!-- Start News Details Area -->
|
<!-- Start News Details Area -->
|
||||||
@endsection
|
@endsection
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#comment").submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('comments.store') }}",
|
||||||
|
type: "POST",
|
||||||
|
data: $(this).serialize(),
|
||||||
|
success: function(data) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
15
routes/CRUDgenerated/route.comments.php
Normal file
15
routes/CRUDgenerated/route.comments.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
use App\Http\Controllers\CommentsController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
Route::prefix("comments")->group(function () {
|
||||||
|
Route::get('/', [CommentsController::class, 'index'])->name('comments.index');
|
||||||
|
Route::get('/create', [CommentsController::class, 'create'])->name('comments.create');
|
||||||
|
Route::post('/store', [CommentsController::class, 'store'])->name('comments.store');
|
||||||
|
Route::post('/sort', [CommentsController::class, 'sort'])->name('comments.sort');
|
||||||
|
Route::post('/updatealias', [CommentsController::class, 'updatealias'])->name('comments.updatealias');
|
||||||
|
Route::get('/show/{id}', [CommentsController::class, 'show'])->name('comments.show');
|
||||||
|
Route::get('/edit/{id}', [CommentsController::class, 'edit'])->name('comments.edit') ;
|
||||||
|
Route::post('/update/{id}', [CommentsController::class, 'update'])->name('comments.update');
|
||||||
|
Route::delete('/destroy/{id}', [CommentsController::class, 'destroy'])->name('comments.destroy');
|
||||||
|
Route::get('/toggle/{id}', [CommentsController::class, 'toggle'])->name('comments.toggle');
|
||||||
|
});
|
@ -9,9 +9,10 @@ use App\Http\Controllers\Auth\PasswordController;
|
|||||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||||
use App\Http\Controllers\Auth\VerifyEmailController;
|
use App\Http\Controllers\Auth\VerifyEmailController;
|
||||||
|
use App\Http\Middleware\PermissionMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware('guest')->group(function () {
|
Route::middleware('guest')->withoutMiddleware([PermissionMiddleware::class])->group(function () {
|
||||||
Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
|
Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
|
||||||
|
|
||||||
Route::post('register', [RegisteredUserController::class, 'store'])->name('register.store');
|
Route::post('register', [RegisteredUserController::class, 'store'])->name('register.store');
|
||||||
@ -34,7 +35,7 @@ Route::middleware('guest')->group(function () {
|
|||||||
->name('password.store');
|
->name('password.store');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware('auth')->group(function () {
|
Route::middleware('auth')->withoutMiddleware([PermissionMiddleware::class])->group(function () {
|
||||||
Route::get('verify-email', EmailVerificationPromptController::class)
|
Route::get('verify-email', EmailVerificationPromptController::class)
|
||||||
->name('verification.notice');
|
->name('verification.notice');
|
||||||
|
|
||||||
|
@ -2,40 +2,45 @@
|
|||||||
|
|
||||||
use App\Http\Controllers\Auth\AuthenticationController;
|
use App\Http\Controllers\Auth\AuthenticationController;
|
||||||
use App\Http\Controllers\WebsiteController;
|
use App\Http\Controllers\WebsiteController;
|
||||||
|
use App\Http\Middleware\PermissionMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
$ccms = new CCMS();
|
$ccms = new CCMS();
|
||||||
define('SITEVARS', CCMS::getSiteVars());
|
define('SITEVARS', CCMS::getSiteVars());
|
||||||
|
|
||||||
Route::get('/userlogin',[AuthenticationController::class, 'login'])->name("userLogin");
|
Route::withoutMiddleware([ PermissionMiddleware::class])->middleware(['web'])->group(function () {
|
||||||
|
Route::get('/userlogin', [AuthenticationController::class, 'login'])->name("userLogin");
|
||||||
|
|
||||||
Route::post('/postlogin',[AuthenticationController::class, 'authenticate'])->name("postLogin");
|
Route::post('/postlogin', [AuthenticationController::class, 'authenticate'])->name("postLogin");
|
||||||
|
|
||||||
Route::get('/userregister',[AuthenticationController::class,'register'])->name("userRegister");
|
Route::get('/userregister', [AuthenticationController::class, 'register'])->name("userRegister");
|
||||||
|
|
||||||
Route::post('/postresgistration',[AuthenticationController::class,'store'])->name("postresgistration");
|
Route::post('/postregistration', [AuthenticationController::class, 'store'])->name("postRegistration");
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('/', [WebsiteController::class, 'home'])->name("home");
|
|
||||||
Route::get('/single/{alias}',[WebsiteController::class, 'single'])->name("single");
|
Route::withoutMiddleware([PermissionMiddleware::class])->group(function () {
|
||||||
Route::get('/newsDetail/{alias}',[WebsiteController::class, 'newsDetail'])->name("newsDetail");
|
Route::get('/', [WebsiteController::class, 'home'])->name("home");
|
||||||
Route::get('/showHororscope',[WebsiteController::class, 'showHororscope'])->name("showHororscope");
|
Route::get('/single/{alias}', [WebsiteController::class, 'single'])->name("single");
|
||||||
Route::get('/international/{alias}',[WebsiteController::class,'showInternational'])->name("showInternational");
|
Route::get('/newsDetail/{alias}', [WebsiteController::class, 'newsDetail'])->name("newsDetail");
|
||||||
Route::get('/showVideos',[WebsiteController::class,'showVideos'])->name("showVideos");
|
Route::get('/showHororscope', [WebsiteController::class, 'showHororscope'])->name("showHororscope");
|
||||||
Route::get('/videoDetail/{alias}',[WebsiteController::class,'videoDetail'])->name("videoDetail");
|
Route::get('/international/{alias}', [WebsiteController::class, 'showInternational'])->name("showInternational");
|
||||||
Route::get('/aboutus/{alias}',[WebsiteController::class,'showAboutus'])->name("showAboutus");
|
Route::get('/showVideos', [WebsiteController::class, 'showVideos'])->name("showVideos");
|
||||||
Route::get('/article/{alias}',[WebsiteController::class,'showArtilce'])->name("showArtilce");
|
Route::get('/videoDetail/{alias}', [WebsiteController::class, 'videoDetail'])->name("videoDetail");
|
||||||
|
Route::get('/aboutus/{alias}', [WebsiteController::class, 'showAboutus'])->name("showAboutus");
|
||||||
Route::get('/provinces/{id}',[WebsiteController::class,'showProvinces'])->name("showProvinces");
|
Route::get('/article/{alias}', [WebsiteController::class, 'showArtilce'])->name("showArtilce");
|
||||||
|
|
||||||
Route::get('/contact',[WebsiteController::class,'showContact'])->name("contact");
|
Route::get('/provinces/{id}', [WebsiteController::class, 'showProvinces'])->name("showProvinces");
|
||||||
Route::post('/sendEmail',[WebsiteController::class,'sendEmail'])->name("sendEmail");
|
|
||||||
|
Route::get('/contact', [WebsiteController::class, 'showContact'])->name("contact");
|
||||||
Route::get('/phpinfo', function() {
|
Route::post('/sendEmail', [WebsiteController::class, 'sendEmail'])->name("sendEmail");
|
||||||
$inipath = php_ini_loaded_file();
|
|
||||||
if ($inipath) {
|
Route::get('/phpinfo', function () {
|
||||||
echo 'Loaded php.ini: ' . $inipath;
|
$inipath = php_ini_loaded_file();
|
||||||
} else {
|
if ($inipath) {
|
||||||
echo 'A php.ini file is not loaded';
|
echo 'Loaded php.ini: ' . $inipath;
|
||||||
}
|
} else {
|
||||||
|
echo 'A php.ini file is not loaded';
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
15
routes/route.comments.php
Normal file
15
routes/route.comments.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
use App\Http\Controllers\CommentsController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
Route::prefix("comments")->group(function () {
|
||||||
|
Route::get('/', [CommentsController::class, 'index'])->name('comments.index');
|
||||||
|
Route::get('/create', [CommentsController::class, 'create'])->name('comments.create');
|
||||||
|
Route::post('/store', [CommentsController::class, 'store'])->name('comments.store');
|
||||||
|
Route::post('/sort', [CommentsController::class, 'sort'])->name('comments.sort');
|
||||||
|
Route::post('/updatealias', [CommentsController::class, 'updatealias'])->name('comments.updatealias');
|
||||||
|
Route::get('/show/{id}', [CommentsController::class, 'show'])->name('comments.show');
|
||||||
|
Route::get('/edit/{id}', [CommentsController::class, 'edit'])->name('comments.edit') ;
|
||||||
|
Route::post('/update/{id}', [CommentsController::class, 'update'])->name('comments.update');
|
||||||
|
Route::delete('/destroy/{id}', [CommentsController::class, 'destroy'])->name('comments.destroy');
|
||||||
|
Route::get('/toggle/{id}', [CommentsController::class, 'toggle'])->name('comments.toggle');
|
||||||
|
});
|
@ -5,4 +5,5 @@ use Illuminate\Support\Facades\Route;
|
|||||||
|
|
||||||
Route::prefix("permissions")->group(function () {
|
Route::prefix("permissions")->group(function () {
|
||||||
Route::resource('/permissions', PermissionsController::class);
|
Route::resource('/permissions', PermissionsController::class);
|
||||||
|
Route::get('/generate-permissions', [PermissionsController::class, 'generatePermissionFromRoutes'])->name('permission.generatePermissionFromRoutes');
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@ use App\Http\Controllers\RolesController;
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::prefix("roles")->group(function () {
|
Route::prefix("roles")->group(function () {
|
||||||
Route::resource('/roles', RolesController::class);
|
// Route::resource('/roles', RolesController::class);
|
||||||
Route::post('/roles/{role}/permissions', [RolesController::class, 'givePermission'])->name('roles.permissions');
|
// Route::post('/roles/{role}/permissions', [RolesController::class, 'givePermission'])->name('roles.permissions');
|
||||||
Route::delete('/roles/{role}/permissions/{permission}', [RolesController::class, 'revokePermission'])->name('roles.permissions.revoke');
|
// Route::delete('/roles/{role}/permissions/{permission}', [RolesController::class, 'revokePermission'])->name('roles.permissions.revoke');
|
||||||
});
|
});
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\UsersController;
|
use App\Http\Controllers\UsersController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
Route::prefix("users")->group(function () {
|
|
||||||
Route::get('/', [UsersController::class, 'index'])->name('users.index');
|
// Route::prefix("users")->group(function () {
|
||||||
Route::get('/create', [UsersController::class, 'create'])->name('users.create');
|
// Route::resource('user', UsersController::class)->names('user');
|
||||||
Route::post('/store', [UsersController::class, 'store'])->name('users.store');
|
// });
|
||||||
Route::get('/show/{id}', [UsersController::class, 'show'])->name('users.show');
|
|
||||||
Route::get('/edit/{id}', [UsersController::class, 'edit'])->name('users.edit') ;
|
|
||||||
Route::post('/update/{user}', [UsersController::class, 'update'])->name('users.update');
|
|
||||||
Route::delete('/destroy/{id}', [UsersController::class, 'destroy'])->name('users.destroy');
|
|
||||||
Route::delete('/users/{user}/roles/{role}', [UsersController::class, 'removeRole'])->name('users.roles.remove');
|
|
||||||
Route::delete('/users/{user}/permissions/{permission}', [UsersController::class, 'revokePermission'])->name('users.permissions.revoke');
|
|
||||||
});
|
|
||||||
|
@ -4,8 +4,9 @@ use App\Http\Controllers\FileController;
|
|||||||
use App\Http\Controllers\FormsController;
|
use App\Http\Controllers\FormsController;
|
||||||
use App\Http\Controllers\GeneralFormController;
|
use App\Http\Controllers\GeneralFormController;
|
||||||
use App\Http\Controllers\ProfileController;
|
use App\Http\Controllers\ProfileController;
|
||||||
use App\Http\Controllers\WebsiteController;
|
use App\Http\Controllers\PermissionsController;
|
||||||
use App\Models\Enquiries;
|
use App\Http\Controllers\UsersController;
|
||||||
|
use App\Http\Controllers\RolesController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
@ -32,12 +33,12 @@ Route::middleware('auth')->group(function () {
|
|||||||
|
|
||||||
Route::middleware('auth')->get('/dashboard', function () {
|
Route::middleware('auth')->get('/dashboard', function () {
|
||||||
return view('backend.dashboard');
|
return view('backend.dashboard');
|
||||||
});
|
})->name('dashboard');
|
||||||
|
|
||||||
Route::middleware('auth')->prefix('admin')->group(function () {
|
Route::middleware('auth')->prefix('admin')->group(function () {
|
||||||
Route::get('/dashboard', function () {
|
Route::get('/dashboard', function () {
|
||||||
return view('backend.dashboard');
|
return view('backend.dashboard');
|
||||||
});
|
})->name('admin.dashboard');
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('backend.dashboard');
|
return view('backend.dashboard');
|
||||||
})->name('admin.dashboard');
|
})->name('admin.dashboard');
|
||||||
@ -83,16 +84,18 @@ Route::middleware('auth')->group(function () {
|
|||||||
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||||
|
|
||||||
//get all enquiries
|
//roles and permissions
|
||||||
// Route::get('/all-enquiries', function () {
|
|
||||||
// $data = Enquiries::where('status', 1)->latest()->with('class')->get();
|
|
||||||
// return view('backend.enquiries-list', compact('data'));
|
|
||||||
// })->name('enquiries-list');
|
|
||||||
|
|
||||||
// Route::delete('/enquiry/destory/{id}', function ($id) {
|
Route::group([], function () {
|
||||||
// $data = Enquiries::findOrFail($id)->delete();
|
Route::resource('user', UsersController::class)->names('user');
|
||||||
// return redirect()->back();
|
Route::resource('role', RolesController::class)->names('role');
|
||||||
// })->name('enquiry.destroy');
|
Route::resource('permission', PermissionsController::class)->names('permission')->only(['index','destroy']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::prefix("permissions")->group(function () {
|
||||||
|
Route::resource('/permissions', PermissionsController::class);
|
||||||
|
Route::get('/generate-permissions', [PermissionsController::class, 'generatePermissionFromRoutes'])->name('permission.generatePermissionFromRoutes');
|
||||||
|
});
|
||||||
|
|
||||||
require __DIR__ . '/route.settings.php';
|
require __DIR__ . '/route.settings.php';
|
||||||
require __DIR__ . '/route.menulocations.php';
|
require __DIR__ . '/route.menulocations.php';
|
||||||
@ -113,6 +116,7 @@ Route::middleware('auth')->group(function () {
|
|||||||
require __DIR__ . '/route.permissions.php';
|
require __DIR__ . '/route.permissions.php';
|
||||||
require __DIR__ . '/route.users.php';
|
require __DIR__ . '/route.users.php';
|
||||||
require __DIR__ . '/route.popups.php';
|
require __DIR__ . '/route.popups.php';
|
||||||
|
require __DIR__ . '/route.comments.php';
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user