changes
This commit is contained in:
parent
5554837c97
commit
adfc826e9c
@ -3,10 +3,13 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Advertisements;
|
||||
use App\Models\Menuitems;
|
||||
use App\Models\User;
|
||||
use App\Models\News;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AuthenticationController extends Controller
|
||||
{
|
||||
@ -15,6 +18,16 @@ class AuthenticationController extends Controller
|
||||
public function __construct()
|
||||
{
|
||||
$this->path = config('app.client_path');
|
||||
$ads = Advertisements::where('status', 1)->where('parent_advertisement',0)->get();
|
||||
$headerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 1])->with('children')->orderBy('display_order')->get();
|
||||
$footerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 2])->with('children')->orderBy('display_order')->get();
|
||||
$latestNews = News::where('status', 1)->inRandomOrder()->limit(4)->get();
|
||||
View::share([
|
||||
'ads' => $ads,
|
||||
'headerMenuItems' => $headerMenuItems,
|
||||
'footerMenuItems' => $footerMenuItems,
|
||||
'latestNews' => $latestNews
|
||||
]);
|
||||
}
|
||||
|
||||
public function login()
|
||||
@ -29,6 +42,7 @@ class AuthenticationController extends Controller
|
||||
|
||||
public static function store(Request $request)
|
||||
{
|
||||
dd($request->all());
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
|
150
app/Http/Controllers/PermissionsController.php
Normal file
150
app/Http/Controllers/PermissionsController.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class PermissionsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Permission $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'index', ' Permissions index');
|
||||
$data = Permission::get();
|
||||
|
||||
return view("crud.generated.permissions.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'create', ' Permissions create');
|
||||
$TableData = Permission::get();
|
||||
return view("crud.generated.permissions.create", compact('TableData'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|max:255',
|
||||
]);
|
||||
|
||||
Permission::create($validated);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Permissions Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('permissions.index')->with('success', 'The Permissions created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Permission::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Permission::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'show', ' Permissions show');
|
||||
$data = Permission::findOrFail($id);
|
||||
|
||||
return view("crud.generated.permissions.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'edit', ' Permissions edit');
|
||||
$TableData = Permission::get();
|
||||
$data = Permission::findOrFail($id);
|
||||
if ($request->ajax()) {
|
||||
$html = view("crud.generated.permissions.ajax.edit", compact('data'))->render();
|
||||
return response()->json(['status' => true, 'content' => $html], 200);
|
||||
}
|
||||
return view("crud.generated.permissions.edit", compact('data', 'TableData'));
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'destroy', ' Permissions destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(PermissionsController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Permissions Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
createActivityLog(PermissionsController::class, 'destroy', ' Permissions destroy');
|
||||
$data = Permission::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(PermissionsController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Permissions Deleted Successfully.'], 200);
|
||||
}
|
||||
}
|
125
app/Http/Controllers/RolesController.php
Normal file
125
app/Http/Controllers/RolesController.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Roles;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class RolesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Roles $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(RolesController::class, 'index', ' Roles index');
|
||||
$data = Role::whereNotIn('name', ['admin'])->get();
|
||||
|
||||
return view("crud.generated.roles.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(RolesController::class, 'create', ' Roles create');
|
||||
$TableData = Roles::get();
|
||||
$permissions = Permission::all();
|
||||
return view("crud.generated.roles.create", compact('TableData', 'permissions'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate(['name' => ['required', 'min:3']]);
|
||||
$role = Role::create($validated);
|
||||
|
||||
if ($role->hasPermissionTo($request->permission, 'web')) {
|
||||
return back()->with('message', 'Permission exists.');
|
||||
}
|
||||
$role->givePermissionTo($request->permission);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Roles Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('roles.index')->with('success', 'The Roles created Successfully.');
|
||||
}
|
||||
|
||||
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 show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(RolesController::class, 'show', ' Roles show');
|
||||
$data = Roles::findOrFail($id);
|
||||
|
||||
return view("crud.generated.roles.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(RolesController::class, 'edit', ' Roles edit');
|
||||
$permissions = Permission::all();
|
||||
$TableData = Role::get();
|
||||
$data = Role::findOrFail($id);
|
||||
if ($request->ajax()) {
|
||||
$html = view("crud.generated.roles.ajax.edit", compact('data'))->render();
|
||||
return response()->json(['status' => true, 'content' => $html], 200);
|
||||
}
|
||||
return view("crud.generated.roles.edit", compact('data', 'TableData', 'permissions'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Role $role)
|
||||
{
|
||||
$permission = $request->permission;
|
||||
$validated = $request->validate(['name' => ['required', 'min:3']]);
|
||||
$role->update($validated);
|
||||
|
||||
if($permission){
|
||||
$role->givePermissionTo($permission);
|
||||
}
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Roles updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('roles.index')->with('success','The Roles updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Roles updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Role $role)
|
||||
{
|
||||
$role->delete();
|
||||
return response()->json(['status' => true, 'message' => 'The Roles Deleted Successfully.'], 200);
|
||||
}
|
||||
|
||||
public function revokePermission(Role $role, Permission $permission)
|
||||
{
|
||||
if ($role->hasPermissionTo($permission)) {
|
||||
$role->revokePermissionTo($permission);
|
||||
return back()->with('message', 'Permission revoked.');
|
||||
}
|
||||
return back()->with('message', 'Permission not exists.');
|
||||
}
|
||||
}
|
117
app/Http/Controllers/UsersController.php
Normal file
117
app/Http/Controllers/UsersController.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
|
||||
public function __construct(User $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(UsersController::class, 'index', 'User index');
|
||||
$data = User::get();
|
||||
return view("crud.generated.users.index", compact('data'));
|
||||
}
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(UsersController::class, 'show', 'User show');
|
||||
$data = User::findOrFail($id);
|
||||
return view("crud.generated.User.show", compact('data'));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(UsersController::class, 'edit', 'User edit');
|
||||
$TableData = User::get();
|
||||
$data = User::findOrFail($id);
|
||||
$roles = Role::all();
|
||||
$permissions = Permission::all();
|
||||
|
||||
if ($request->ajax()) {
|
||||
$html = view("crud.generated.User.ajax.edit", compact('data'))->render();
|
||||
return response()->json(['status' => true, 'content' => $html], 200);
|
||||
}
|
||||
|
||||
return view("crud.generated.users.edit", compact('data', 'TableData', 'roles', 'permissions'));
|
||||
}
|
||||
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
// dd($request->toArray());
|
||||
|
||||
if ($request->permission) {
|
||||
if ($user->hasPermissionTo($request->permission)) {
|
||||
return redirect()->back()->with('error', 'The User already has this permission.');
|
||||
}
|
||||
$user->givePermissionTo($request->permission);
|
||||
}
|
||||
if ($request->role) {
|
||||
if ($user->hasRole($request->role)) {
|
||||
return redirect()->back()->with('error', 'The User already has this role.');
|
||||
}
|
||||
$user->assignRole($request->role);
|
||||
}
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The User updated Successfully.'], 200);
|
||||
}
|
||||
|
||||
// Logic to update user should be added here
|
||||
|
||||
return redirect()->back()->with('success', 'The User updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
createActivityLog(UsersController::class, 'destroy', 'User destroy');
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(UsersController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The User Deleted Successfully.'], 200);
|
||||
}
|
||||
|
||||
public function removeRole(User $user, Role $role)
|
||||
{
|
||||
if ($user->hasRole($role)) {
|
||||
$user->removeRole($role);
|
||||
return back()->with('message', 'Role removed.');
|
||||
}
|
||||
|
||||
return back()->with('message', 'Role not exists.');
|
||||
}
|
||||
|
||||
public function revokePermission(User $user, Permission $permission)
|
||||
{
|
||||
if ($user->hasPermissionTo($permission)) {
|
||||
$user->revokePermissionTo($permission);
|
||||
return back()->with('message', 'Permission revoked.');
|
||||
}
|
||||
return back()->with('message', 'Permission does not exists.');
|
||||
}
|
||||
}
|
@ -51,7 +51,8 @@ class VideosController extends Controller
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->mergeIfMissing(['alias' => slugify($request->title)]);
|
||||
$request->mergeIfMissing(['alias' => Str::slug($request->title)]);
|
||||
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_videos')]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
@ -134,7 +135,7 @@ class VideosController extends Controller
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->mergeIfMissing(['alias' => slugify($request->title)]);
|
||||
$request->mergeIfMissing(['alias' => Str::slug($request->title)]);
|
||||
$filterData = $request->except(['_token', '_method']);
|
||||
array_walk_recursive($filterData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
|
@ -177,15 +177,10 @@ class WebsiteController extends Controller
|
||||
$data = News::where('provinces_id',$id)->where('status',1)->orderBy('display_order')->paginate(9);
|
||||
return view($this->path . '.single', compact('data','categoryTitle'));
|
||||
}
|
||||
|
||||
public function videoDetail($alias){
|
||||
$data = Videos::where('alias', $alias)->where('status', 1)->first();
|
||||
$recentNews = News::where('status',1)->inRandomOrder()->limit(12)->latest()->get();
|
||||
return view($this->path . '.video-detail', compact('data','recentNews'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public function single($alias)
|
||||
// {
|
||||
// $categoryId = Newscategories::where('alias', $alias)->pluck('category_id')->first();
|
||||
// $categoryTitle = Newscategories::where('alias', $alias)->pluck('nepali_title')->first();
|
||||
|
||||
// $data = News::where('newscategories_id', $categoryId)->where('status', 1)->orderBy('display_order')->paginate(9);
|
||||
|
||||
// return view($this->path . '.single', compact('data', 'categoryTitle'));
|
||||
// }
|
45
app/Models/Permissions.php
Normal file
45
app/Models/Permissions.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?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;
|
||||
|
||||
class Permissions extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'guard_name',
|
||||
'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>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
44
app/Models/Roles.php
Normal file
44
app/Models/Roles.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?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;
|
||||
|
||||
class Roles extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
protected $fillable =[
|
||||
'name',
|
||||
'guard_name',
|
||||
'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>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
@ -7,10 +7,11 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
@ -12,6 +12,7 @@
|
||||
"laravel/framework": "^10.10",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.8",
|
||||
"spatie/laravel-permission": "^6.7",
|
||||
"symfony/process": "^6.3",
|
||||
"unisharp/laravel-filemanager": "^2.6"
|
||||
},
|
||||
|
84
composer.lock
generated
84
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "c01d9fba41ba7441a0f6055ccba08d45",
|
||||
"content-hash": "21f9bae5dfa5a7adda4fc9f1ddad3d38",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brian2694/laravel-toastr",
|
||||
@ -3434,6 +3434,88 @@
|
||||
],
|
||||
"time": "2023-11-08T05:53:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "6.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-permission.git",
|
||||
"reference": "17607924aa0aa89bc0153c2ce45ed7c55083367b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/17607924aa0aa89bc0153c2ce45ed7c55083367b",
|
||||
"reference": "17607924aa0aa89bc0153c2ce45ed7c55083367b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/auth": "^8.12|^9.0|^10.0|^11.0",
|
||||
"illuminate/container": "^8.12|^9.0|^10.0|^11.0",
|
||||
"illuminate/contracts": "^8.12|^9.0|^10.0|^11.0",
|
||||
"illuminate/database": "^8.12|^9.0|^10.0|^11.0",
|
||||
"php": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/passport": "^11.0|^12.0",
|
||||
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0",
|
||||
"phpunit/phpunit": "^9.4|^10.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "6.x-dev",
|
||||
"dev-master": "6.x-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Spatie\\Permission\\PermissionServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Spatie\\Permission\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Permission handling for Laravel 8.0 and up",
|
||||
"homepage": "https://github.com/spatie/laravel-permission",
|
||||
"keywords": [
|
||||
"acl",
|
||||
"laravel",
|
||||
"permission",
|
||||
"permissions",
|
||||
"rbac",
|
||||
"roles",
|
||||
"security",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-permission/issues",
|
||||
"source": "https://github.com/spatie/laravel-permission/tree/6.7.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-19T12:35:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v6.4.3",
|
||||
|
@ -173,6 +173,7 @@ return [
|
||||
// App\Providers\LaravelInstallerServiceProvider::class,
|
||||
Bibhuti\Installer\Providers\LaravelInstallerServiceProvider::class,
|
||||
Brian2694\Toastr\ToastrServiceProvider::class,
|
||||
Spatie\Permission\PermissionServiceProvider::class,
|
||||
|
||||
|
||||
])->toArray(),
|
||||
|
186
config/permission.php
Normal file
186
config/permission.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
|
||||
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
|
||||
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
|
||||
*/
|
||||
'register_octane_reset_listener' => false,
|
||||
|
||||
/*
|
||||
* Teams Feature.
|
||||
* When set to true the package implements teams using the 'team_foreign_key'.
|
||||
* If you want the migrations to register the 'team_foreign_key', you must
|
||||
* set this to true before doing the migration.
|
||||
* If you already did the migration then you must make a new migration to also
|
||||
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
|
||||
* (view the latest version of this package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* Passport Client Credentials Grant
|
||||
* When set to true the package will use Passports Client to check permissions
|
||||
*/
|
||||
|
||||
'use_passport_client_credentials' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
* See documentation to understand supported syntax.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
/*
|
||||
* The class to use for interpreting wildcard permissions.
|
||||
* If you need to modify delimiters, override the class and specify its name here.
|
||||
*/
|
||||
// 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
|
||||
|
||||
/* Cache-specific settings */
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
220
database/seeders/AdsCategorySeeder.php
Normal file
220
database/seeders/AdsCategorySeeder.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Adcategories;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdsCategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Adcategories::create([
|
||||
'category_id' => 1,
|
||||
'title' => 'navbar',
|
||||
'alias' => 'navbar',
|
||||
'status' => 1,
|
||||
'display_order' => 1,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 2,
|
||||
'title' => 'header',
|
||||
'alias' => 'header',
|
||||
'status' => 1,
|
||||
'display_order' => 2,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 3,
|
||||
'title' => 'feature-news',
|
||||
'alias' => 'feature-news',
|
||||
'status' => 1,
|
||||
'display_order' => 3,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 4,
|
||||
'title' => 'province',
|
||||
'alias' => 'province',
|
||||
'status' => 1,
|
||||
'display_order' => 4,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 5,
|
||||
'title' => 'int-sidebar',
|
||||
'alias' => 'int-sidebar',
|
||||
'status' => 1,
|
||||
'display_order' => 5,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
Adcategories::create([
|
||||
'category_id' => 6,
|
||||
'title' => 'politics',
|
||||
'alias' => 'politics',
|
||||
'status' => 1,
|
||||
'display_order' => 6,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 7,
|
||||
'title' => 'politics-sidebar',
|
||||
'alias' => 'politics-sidebar',
|
||||
'status' => 1,
|
||||
'display_order' => 7,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 8,
|
||||
'title' => 'economics',
|
||||
'alias' => 'economics',
|
||||
'status' => 1,
|
||||
'display_order' => 8,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 9,
|
||||
'title' => 'economics-sidebar',
|
||||
'alias' => 'economics-sidebar',
|
||||
'status' => 1,
|
||||
'display_order' => 9,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 10,
|
||||
'title' => 'cul-tech',
|
||||
'alias' => 'cul-tech',
|
||||
'status' => 1,
|
||||
'display_order' => 10,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 11,
|
||||
'title' => 'cul-tech-sidebar',
|
||||
'alias' => 'cul-tech-sidebar',
|
||||
'status' => 1,
|
||||
'display_order' => 11,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 12,
|
||||
'title' => 'feature',
|
||||
'alias' => 'feature',
|
||||
'status' => 1,
|
||||
'display_order' => 12,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 13,
|
||||
'title' => 'feature-sidebar',
|
||||
'alias' => 'feature-sidebar',
|
||||
'status' => 1,
|
||||
'display_order' => 13,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 14,
|
||||
'title' => 'video',
|
||||
'alias' => 'video',
|
||||
'status' => 1,
|
||||
'display_order' => 14,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 15,
|
||||
'title' => 'health',
|
||||
'alias' => 'health',
|
||||
'status' => 1,
|
||||
'display_order' => 15,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 16,
|
||||
'title' => 'inner-page-bottom',
|
||||
'alias' => 'inner-page-bottom',
|
||||
'status' => 1,
|
||||
'display_order' => 16,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
|
||||
Adcategories::create([
|
||||
'category_id' => 17,
|
||||
'title' => 'inner-page-header',
|
||||
'alias' => 'inner-page-header',
|
||||
'status' => 1,
|
||||
'display_order' => 17,
|
||||
'createdBy' => 1,
|
||||
'updatedBy' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
}
|
||||
}
|
@ -12,11 +12,13 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call(RoleSeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(ProvinceSeeder::class);
|
||||
$this->call(NewsTypeSeeder::class);
|
||||
$this->call(NewsCategorySeeder::class);
|
||||
$this->call(HoroscopeSeeder::class);
|
||||
$this->call(WebsiteSettingSeeder::class);
|
||||
$this->call(AdsCategorySeeder::class);
|
||||
}
|
||||
}
|
||||
|
20
database/seeders/RoleSeeder.php
Normal file
20
database/seeders/RoleSeeder.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$role = Role::create(['name' => 'admin']);
|
||||
$role = Role::create(['name' => 'editor']);
|
||||
$role = Role::create(['name' => 'user']);
|
||||
}
|
||||
}
|
@ -17,10 +17,9 @@ class UserSeeder extends Seeder
|
||||
'name' => 'Prajwal Adhikari',
|
||||
'email' => 'prajwalbro@hotmail.com',
|
||||
'username' => 'prajwalbro',
|
||||
'password' => '$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW',
|
||||
'password' => bcrypt('p@ssw0rd'),
|
||||
'status' => 1,
|
||||
'role' => 'super_admin'
|
||||
|
||||
]);
|
||||
'email_verified_at' => now(),
|
||||
])->assignRole('admin', 'editor');
|
||||
}
|
||||
}
|
||||
|
@ -81,18 +81,55 @@
|
||||
</li> <!-- end Dashboard Menu -->
|
||||
|
||||
<li class="menu-title"><i class="ri-more-fill"></i> <span data-key="t-pages">Pages</span></li>
|
||||
{{ CCMS::createMenuLink('Provinces', route('provinces.index')) }}
|
||||
{{ CCMS::createMenuLink('News Type', route('news_type.index')) }}
|
||||
{{ CCMS::createMenuLink('News Categories', route('newscategories.index')) }}
|
||||
{{ CCMS::createMenuLink('News', route('news.index')) }}
|
||||
{{ CCMS::createMenuLink('Authors', route('authors.index')) }}
|
||||
{{ CCMS::createMenuLink('Economy', route('economies.index')) }}
|
||||
{{ CCMS::createMenuLink('Videos', route('videos.index')) }}
|
||||
{{ CCMS::createMenuLink('Horoscope', route('horoscope.index')) }}
|
||||
{{ CCMS::createMenuLink('Artilces', route('articles.index')) }}
|
||||
{{ CCMS::createMenuLink('Teams', route('teams.index')) }}
|
||||
{{ CCMS::createMenuLink('Advertisements', route('advertisements.index')) }}
|
||||
{{ CCMS::createMenuLink('Ad Category', route('adcategories.index')) }}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link collapsed" href="#sidebarMenu2" data-bs-toggle="collapse"
|
||||
role="button" aria-expanded="false" aria-controls="sidebarMenu1">
|
||||
<i class="ri-pages-line"></i> <span data-key="t-pages">News</span>
|
||||
</a>
|
||||
<div class="collapse menu-dropdown" id="sidebarMenu2">
|
||||
<ul class="nav nav-sm flex-column">
|
||||
{{ CCMS::createMenuLink('News Type', route('news_type.index')) }}
|
||||
{{ CCMS::createMenuLink('News Categories', route('newscategories.index')) }}
|
||||
{{ CCMS::createMenuLink('News', route('news.index')) }}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link menu-link collapsed" href="#sidebarMenu3" data-bs-toggle="collapse"
|
||||
role="button" aria-expanded="false" aria-controls="sidebarMenu1">
|
||||
<i class="ri-pages-line"></i> <span data-key="t-pages">Ads</span>
|
||||
</a>
|
||||
<div class="collapse menu-dropdown" id="sidebarMenu3">
|
||||
<ul class="nav nav-sm flex-column">
|
||||
{{ CCMS::createMenuLink('Advertisements', route('advertisements.index')) }}
|
||||
{{ CCMS::createMenuLink('Ad Category', route('adcategories.index')) }}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@role('admin')
|
||||
<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('roles.index')) }}
|
||||
{{ CCMS::createMenuLink('Permissions', route('permissions.index')) }}
|
||||
{{ CCMS::createMenuLink('Users', route('users.index')) }}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@endrole
|
||||
|
||||
{{ CCMS::createMenuLink('Provinces', route('provinces.index')) }}
|
||||
{{ CCMS::createMenuLink('Authors', route('authors.index')) }}
|
||||
{{ CCMS::createMenuLink('Economy', route('economies.index')) }}
|
||||
{{ CCMS::createMenuLink('Videos', route('videos.index')) }}
|
||||
{{ CCMS::createMenuLink('Horoscope', route('horoscope.index')) }}
|
||||
{{ CCMS::createMenuLink('Artilces', route('articles.index')) }}
|
||||
{{ CCMS::createMenuLink('Teams', route('teams.index')) }}
|
||||
|
||||
</div>
|
||||
|
||||
|
17
resources/views/crud/generated/permissions/create.blade.php
Normal file
17
resources/views/crud/generated/permissions/create.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
@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
|
25
resources/views/crud/generated/permissions/edit.blade.php
Normal file
25
resources/views/crud/generated/permissions/edit.blade.php
Normal file
@ -0,0 +1,25 @@
|
||||
@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
|
185
resources/views/crud/generated/permissions/index.blade.php
Normal file
185
resources/views/crud/generated/permissions/index.blade.php
Normal file
@ -0,0 +1,185 @@
|
||||
@extends('backend.template')
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<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>
|
||||
</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) {
|
||||
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
|
28
resources/views/crud/generated/permissions/show.blade.php
Normal file
28
resources/views/crud/generated/permissions/show.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
@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
|
34
resources/views/crud/generated/roles/create.blade.php
Normal file
34
resources/views/crud/generated/roles/create.blade.php
Normal file
@ -0,0 +1,34 @@
|
||||
@extends('backend.template')
|
||||
@section('content')
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2 class="">{{ label('Add Roles') }}</h2>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('roles.index')); ?>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<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>
|
||||
@endsection
|
||||
|
||||
|
69
resources/views/crud/generated/roles/edit.blade.php
Normal file
69
resources/views/crud/generated/roles/edit.blade.php
Normal file
@ -0,0 +1,69 @@
|
||||
@extends('backend.template')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="card col-8">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ __('Edit Roles') }}</h2>
|
||||
<a href="{{ route('roles.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form action="{{ route('roles.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">
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
@endsection
|
185
resources/views/crud/generated/roles/index.blade.php
Normal file
185
resources/views/crud/generated/roles/index.blade.php
Normal file
@ -0,0 +1,185 @@
|
||||
@extends('backend.template')
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Roles List') }}</h2>
|
||||
<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>
|
||||
</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) {
|
||||
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
|
28
resources/views/crud/generated/roles/show.blade.php
Normal file
28
resources/views/crud/generated/roles/show.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
@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
|
25
resources/views/crud/generated/users/create.blade.php
Normal file
25
resources/views/crud/generated/users/create.blade.php
Normal file
@ -0,0 +1,25 @@
|
||||
@extends('backend.template')
|
||||
@section('content')
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2 class="">{{ label('Add Users') }}</h2>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('users.index')); ?>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<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>
|
||||
@endsection
|
100
resources/views/crud/generated/users/edit.blade.php
Normal file
100
resources/views/crud/generated/users/edit.blade.php
Normal file
@ -0,0 +1,100 @@
|
||||
@extends('backend.template')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ __('Edit Users') }}</h2>
|
||||
<a href="{{ route('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
||||
</div>
|
||||
<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">
|
||||
<label for="permission" class="form-label">Permission</label>
|
||||
<select id="permission" name="permission" autocomplete="permission-name"
|
||||
class="form-select">
|
||||
<option value="0"> Add Permission </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('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<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>
|
||||
@endsection
|
187
resources/views/crud/generated/users/index.blade.php
Normal file
187
resources/views/crud/generated/users/index.blade.php
Normal file
@ -0,0 +1,187 @@
|
||||
@extends('backend.template')
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Users List') }}</h2>
|
||||
{{-- <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>
|
||||
</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) {
|
||||
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
|
29
resources/views/crud/generated/users/show.blade.php
Normal file
29
resources/views/crud/generated/users/show.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><?php echo label('View Details'); ?></h2>
|
||||
<?php createButton("btn-primary btn-cancel","","Back to List",route('users.index')); ?>
|
||||
|
||||
</div>
|
||||
<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
|
||||
class="{{$data->status == 1 ? 'text-success' : 'text-danger'}}">{{$data->status == 1 ? 'Active' : 'Inactive'}}</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
|
@ -42,7 +42,7 @@
|
||||
<button type="submit">लगइन</button>
|
||||
</form>
|
||||
<div class="important-text">
|
||||
<p>खाता छैन? <a href="{{route('userRegister')}}">रजिस्टर गर्नुहोस !</a></p>
|
||||
<p>खाता छैन? <a href="{{route('userRegister')}}">लगइन गर्नुहोस! </a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,22 +19,24 @@
|
||||
<div class="container">
|
||||
<div class="register-form">
|
||||
<h2>रजिस्टर</h2>
|
||||
<form>
|
||||
<form id="register-form" action={{ route('postresgistration') }} method="POST">
|
||||
@csrf
|
||||
@method('POST')
|
||||
<div class="form-group">
|
||||
<label>नाम</label>
|
||||
<input type="text" class="form-control" placeholder="नाम">
|
||||
<input type="text" class="form-control" placeholder="नाम" id="name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ईमेल</label>
|
||||
<input type="text" class="form-control" placeholder="ईमेल">
|
||||
<input type="text" class="form-control" placeholder="ईमेल" id="email">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>फोन</label>
|
||||
<input type="text" class="form-control" placeholder="फोन">
|
||||
<input type="text" class="form-control" placeholder="फोन" id="phone">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>पासवर्ड</label>
|
||||
<input type="text" class="form-control" placeholder="पासवर्ड">
|
||||
<input type="text" class="form-control" placeholder="पासवर्ड" id="password">
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@ -47,7 +49,7 @@
|
||||
<button type="submit">रजिस्टर गर्नुहोस</button>
|
||||
</form>
|
||||
<div class="important-text">
|
||||
<p>खाता छ? <a href="{{route('userLogin')}}">लगइन गर्नुहोस!</a></p>
|
||||
<p>खाता छ? <a href="{{route('postresgistration')}}">रजिस्टर गर्नुहोस !</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -56,21 +58,21 @@
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#rregister-form').submit(function(e) {
|
||||
$('#register-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
let form = $(this);
|
||||
let name = $('#name').val();
|
||||
let email = $('#email').val();
|
||||
let password = $('#password').val();
|
||||
let password_confirmation = $('#password_confirmation').val();
|
||||
let phone = $('#phone').val();
|
||||
$.ajax({
|
||||
url: form.attr('action'),
|
||||
type: "POST",
|
||||
data: {
|
||||
name: name,
|
||||
email: email,
|
||||
phone: phone,
|
||||
password: password,
|
||||
password_confirmation: password_confirmation,
|
||||
_token: "{{ csrf_token() }}"
|
||||
},
|
||||
success: function(response) {
|
||||
|
@ -21,11 +21,11 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="news-content" style="text-align: center; margin: 3%;">
|
||||
<h2>
|
||||
<a href="news-details.php"><b>{{ $featuredNews->short_description }}</b></a>
|
||||
<a href="{{ route('newsDetail', ['alias' => $featuredNews->alias]) }}"><b>{{ $featuredNews->short_description }}</b></a>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="single-main-news">
|
||||
<a href="news-details.php">
|
||||
<a href="{{ route('newsDetail', ['alias' => $featuredNews->alias]) }}">
|
||||
<img src="{{ asset($featuredNews->image) }}" alt="image">
|
||||
</a>
|
||||
</div>
|
||||
|
@ -48,22 +48,23 @@
|
||||
</div>
|
||||
|
||||
<section class="default-news-area pt-5">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@if ($ads->isNotEmpty())
|
||||
@foreach ($ads as $ad)
|
||||
@if ($ad->ad_categories_id == 16)
|
||||
<a href="{{ $ad->link }}">
|
||||
<img src="{{ asset($ad->thumb) }}" alt="{{ $ad->title }}" class="img-fluid">
|
||||
</a>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@if ($ads->isNotEmpty())
|
||||
@foreach ($ads as $ad)
|
||||
@if ($ad->ad_categories_id == 16)
|
||||
<a href="{{ $ad->link }}">
|
||||
<img src="{{ asset($ad->thumb) }}" alt="{{ $ad->title }}"
|
||||
class="img-fluid">
|
||||
</a>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
@ -92,10 +93,10 @@
|
||||
</section>
|
||||
</div><br>
|
||||
|
||||
<section class="widget widget_featured_reports">
|
||||
{{-- <section class="widget widget_featured_reports">
|
||||
<img src="{{ asset('hulaki/assets/img/ad/prabhu_pay_onlinekhabar.gif') }}" alt="image"
|
||||
class="img-fluid">
|
||||
</section>
|
||||
</section> --}}
|
||||
|
||||
</aside>
|
||||
</div>
|
||||
|
@ -42,7 +42,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<i class='bx bx-user'></i>
|
||||
<a href="login.php">लगइन</a>
|
||||
<a href="{{route('userLogin')}}">लगइन</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -56,7 +56,7 @@
|
||||
<div class="main-responsive-nav">
|
||||
<div class="container">
|
||||
<div class="logo">
|
||||
<a href="index.php">
|
||||
<a href="{{route('home')}}">
|
||||
<img src="<?php echo asset(SITEVARS->primary_logo); ?>" class="black-logo" alt="image">
|
||||
<img src="<?php echo asset(SITEVARS->secondary_logo); ?>" class="white-logo" alt="image">
|
||||
</a>
|
||||
@ -77,7 +77,7 @@
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<nav class="navbar navbar-expand-sm navbar-light">
|
||||
<a class="navbar-brand" href="index.php">
|
||||
<a class="navbar-brand" href="{{route('home')}}">
|
||||
<img src="<?php echo asset(SITEVARS->primary_logo); ?>" class="black-logo" alt="image"
|
||||
style="margin-left: -20px;max-width: 350px; height: auto; display: block;">
|
||||
<img src="<?php echo asset(SITEVARS->secondary_logo); ?>" class="white-logo" alt="image" style="margin-left: -20px;">
|
||||
|
142
resources/views/hulaki_khabar/video-detail.blade.php
Normal file
142
resources/views/hulaki_khabar/video-detail.blade.php
Normal file
@ -0,0 +1,142 @@
|
||||
@extends('hulaki_khabar.layout.layout')
|
||||
|
||||
@section('content')
|
||||
<section class="news-details-area bg-ffffff ptb-50">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-9 col-md-9">
|
||||
<div class="blog-details-desc">
|
||||
<h3 id="sidebar">{{ $data->title }}</h3>
|
||||
{{-- <div class="article-image">
|
||||
<img src="{{$data->image}}" alt="image">
|
||||
</div> --}}
|
||||
<section class="default-news-area ptb-50">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-4">
|
||||
<div class="single-video-item">
|
||||
<div class="video-news-image">
|
||||
<a href="video-details.php">
|
||||
<img src="{{ asset($data->image) }}" alt="image">
|
||||
</a>
|
||||
<a href="{{ $data->video_url }}" class="popup-youtube">
|
||||
<i class='bx bx-play-circle'></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="article-content">
|
||||
<div class="sports-news-content">
|
||||
{!! $data->description !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<section class="default-news-area pt-5">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
@if ($ads->isNotEmpty())
|
||||
@foreach ($ads as $ad)
|
||||
@if ($ad->ad_categories_id == 16)
|
||||
<a href="{{ $ad->link }}">
|
||||
<img src="{{ asset($ad->thumb) }}" alt="{{ $ad->title }}"
|
||||
class="img-fluid">
|
||||
</a>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<div class="comments-area">
|
||||
<h3 class="comments-title">२ कमेन्ट :</h3>
|
||||
<ol class="comment-list">
|
||||
<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">राम </b>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="comment-content">
|
||||
<p>देशलाई दशा लाग्नुको मुख्य कारण । हामीलाई आफ्नो मान्छे, आफ्नो जिल्ला, आफ्नो
|
||||
पार्टी, आफ्नो परिवार, आफ्नो जातभन्दा माथि उठ्नु नै छैन, यस्तै कुरामा खुसी भएर
|
||||
एउटै ढाडेलाई पाँच सात पटकसम्म जिताउन यस्तै लुटतन्त्रको भूमिका छ ।</p>
|
||||
</div>
|
||||
<div class="reply">
|
||||
<a href="#" class="comment-reply-link">रिप्लाई </a>
|
||||
</div>
|
||||
</div>
|
||||
<ol class="children">
|
||||
<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">हरी </b>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="comment-content">
|
||||
<p>बजेट मात्र परेर के गर्नु बिकास सुन्री छ । सबै बजेट आफ्नो कार्यकर्ता र
|
||||
झोलेहरुको पेट भर्दै सक्छ्न ।</p>
|
||||
</div>
|
||||
<div class="reply">
|
||||
<a href="#" class="comment-reply-link">रिप्लाई </a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="comment-respond">
|
||||
<h3 class="comment-reply-title">रिप्लाई दिनुहोस </h3>
|
||||
<form class="comment-form">
|
||||
<p class="comment-form-comment">
|
||||
<label>कमेन्ट </label>
|
||||
<textarea name="comment" id="comment" cols="45" placeholder="कमेन्ट ...*" rows="5" maxlength="65525"
|
||||
required="required"></textarea>
|
||||
</p>
|
||||
<p class="form-submit">
|
||||
<input type="submit" name="submit" id="submit" class="submit" value="पोस्ट ">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-3" id="sidebar">
|
||||
<aside class="widget-area mt-50">
|
||||
<div>
|
||||
<section class="widget widget_latest_news_thumb">
|
||||
<h3 class="widget-title">पछिल्लो समाचार </h3>
|
||||
@foreach ($recentNews as $item)
|
||||
<article class="item">
|
||||
<a href="{{route('newsDetail',['alias'=> $item->alias])}}" class="thumb">
|
||||
<img src="{{ asset($item->image) }}" alt="{{ $item->title }}">
|
||||
</a>
|
||||
<div class="info">
|
||||
<h4 class="title usmall"><a href="{{route('newsDetail',['alias'=> $item->alias])}}">{{ $item->title }}</a></h4>
|
||||
</div>
|
||||
</article>
|
||||
@endforeach
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
@ -25,7 +25,7 @@
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-4">
|
||||
<div class="video-news-image">
|
||||
<a href="news-details.php">
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}">
|
||||
<img src="{{ $video->image }}" alt="image">
|
||||
</a>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<div class="col-lg-8">
|
||||
<div class="video-news-content mt-0">
|
||||
<h3>
|
||||
<a href="news-details.php">{{ $video->title }}</a>
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}" style="font-size: 30px;">{{ $video->title }}</a>
|
||||
</h3>
|
||||
<p>{!! $video->description !!}</p>
|
||||
</div>
|
||||
@ -53,7 +53,7 @@
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="single-video-item">
|
||||
<div class="video-news-image">
|
||||
<a href="news-details.php">
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}">
|
||||
<img src="{{ $video->image }}" alt="image">
|
||||
</a>
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
<div class="video-news-content">
|
||||
<h3>
|
||||
<a href="news-details.php">{{ $video->title }}</a>
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}">{{ $video->title }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
@ -77,7 +77,7 @@
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="video-item mb-30">
|
||||
<div class="video-news-image">
|
||||
<a href="news-details.php">
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}">
|
||||
<img src="{{ $video->image }}" alt="image">
|
||||
</a>
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
|
||||
<div class="video-news-content">
|
||||
<h3>
|
||||
<a href="news-details.php">{{ $video->title }}</a>
|
||||
<a href="{{route('videoDetail',['alias'=> $video->alias])}}">{{ $video->title }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
15
routes/CRUDgenerated/route.permissions.php
Normal file
15
routes/CRUDgenerated/route.permissions.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use App\Http\Controllers\PermissionsController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
Route::prefix("permissions")->group(function () {
|
||||
Route::get('/', [PermissionsController::class, 'index'])->name('permissions.index');
|
||||
Route::get('/create', [PermissionsController::class, 'create'])->name('permissions.create');
|
||||
Route::post('/store', [PermissionsController::class, 'store'])->name('permissions.store');
|
||||
Route::post('/sort', [PermissionsController::class, 'sort'])->name('permissions.sort');
|
||||
Route::post('/updatealias', [PermissionsController::class, 'updatealias'])->name('permissions.updatealias');
|
||||
Route::get('/show/{id}', [PermissionsController::class, 'show'])->name('permissions.show');
|
||||
Route::get('/edit/{id}', [PermissionsController::class, 'edit'])->name('permissions.edit') ;
|
||||
Route::post('/update/{id}', [PermissionsController::class, 'update'])->name('permissions.update');
|
||||
Route::delete('/destroy/{id}', [PermissionsController::class, 'destroy'])->name('permissions.destroy');
|
||||
Route::get('/toggle/{id}', [PermissionsController::class, 'toggle'])->name('permissions.toggle');
|
||||
});
|
15
routes/CRUDgenerated/route.roles.php
Normal file
15
routes/CRUDgenerated/route.roles.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use App\Http\Controllers\RolesController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
Route::prefix("roles")->group(function () {
|
||||
Route::get('/', [RolesController::class, 'index'])->name('roles.index');
|
||||
Route::get('/create', [RolesController::class, 'create'])->name('roles.create');
|
||||
Route::post('/store', [RolesController::class, 'store'])->name('roles.store');
|
||||
Route::post('/sort', [RolesController::class, 'sort'])->name('roles.sort');
|
||||
Route::post('/updatealias', [RolesController::class, 'updatealias'])->name('roles.updatealias');
|
||||
Route::get('/show/{id}', [RolesController::class, 'show'])->name('roles.show');
|
||||
Route::get('/edit/{id}', [RolesController::class, 'edit'])->name('roles.edit') ;
|
||||
Route::post('/update/{id}', [RolesController::class, 'update'])->name('roles.update');
|
||||
Route::delete('/destroy/{id}', [RolesController::class, 'destroy'])->name('roles.destroy');
|
||||
Route::get('/toggle/{id}', [RolesController::class, 'toggle'])->name('roles.toggle');
|
||||
});
|
15
routes/CRUDgenerated/route.users.php
Normal file
15
routes/CRUDgenerated/route.users.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use App\Http\Controllers\UsersController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
Route::prefix("users")->group(function () {
|
||||
Route::get('/', [UsersController::class, 'index'])->name('users.index');
|
||||
Route::get('/create', [UsersController::class, 'create'])->name('users.create');
|
||||
Route::post('/store', [UsersController::class, 'store'])->name('users.store');
|
||||
Route::post('/sort', [UsersController::class, 'sort'])->name('users.sort');
|
||||
Route::post('/updatealias', [UsersController::class, 'updatealias'])->name('users.updatealias');
|
||||
Route::get('/show/{id}', [UsersController::class, 'show'])->name('users.show');
|
||||
Route::get('/edit/{id}', [UsersController::class, 'edit'])->name('users.edit') ;
|
||||
Route::post('/update/{id}', [UsersController::class, 'update'])->name('users.update');
|
||||
Route::delete('/destroy/{id}', [UsersController::class, 'destroy'])->name('users.destroy');
|
||||
Route::get('/toggle/{id}', [UsersController::class, 'toggle'])->name('users.toggle');
|
||||
});
|
@ -22,7 +22,7 @@ Route::get('/newsDetail/{alias}',[WebsiteController::class, 'newsDetail'])->name
|
||||
Route::get('/showHororscope',[WebsiteController::class, 'showHororscope'])->name("showHororscope");
|
||||
Route::get('/international/{alias}',[WebsiteController::class,'showInternational'])->name("showInternational");
|
||||
Route::get('/showVideos',[WebsiteController::class,'showVideos'])->name("showVideos");
|
||||
|
||||
Route::get('/videoDetail/{alias}',[WebsiteController::class,'videoDetail'])->name("videoDetail");
|
||||
Route::get('/aboutus/{alias}',[WebsiteController::class,'showAboutus'])->name("showAboutus");
|
||||
Route::get('/article/{alias}',[WebsiteController::class,'showArtilce'])->name("showArtilce");
|
||||
|
||||
|
8
routes/route.permissions.php
Normal file
8
routes/route.permissions.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\PermissionsController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::prefix("permissions")->group(function () {
|
||||
Route::resource('/permissions', PermissionsController::class);
|
||||
});
|
10
routes/route.roles.php
Normal file
10
routes/route.roles.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\RolesController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::prefix("roles")->group(function () {
|
||||
Route::resource('/roles', RolesController::class);
|
||||
Route::post('/roles/{role}/permissions', [RolesController::class, 'givePermission'])->name('roles.permissions');
|
||||
Route::delete('/roles/{role}/permissions/{permission}', [RolesController::class, 'revokePermission'])->name('roles.permissions.revoke');
|
||||
});
|
14
routes/route.users.php
Normal file
14
routes/route.users.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
use App\Http\Controllers\UsersController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
Route::prefix("users")->group(function () {
|
||||
Route::get('/', [UsersController::class, 'index'])->name('users.index');
|
||||
Route::get('/create', [UsersController::class, 'create'])->name('users.create');
|
||||
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');
|
||||
});
|
@ -109,6 +109,9 @@ Route::middleware('auth')->group(function () {
|
||||
require __DIR__ . '/route.teams.php';
|
||||
require __DIR__ . '/route.advertisements.php';
|
||||
require __DIR__ . '/route.adcategories.php';
|
||||
require __DIR__ . '/route.roles.php';
|
||||
require __DIR__ . '/route.permissions.php';
|
||||
require __DIR__ . '/route.users.php';
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user