redirecting users accord to their particular role

This commit is contained in:
Htet Phone 2023-11-02 09:42:05 +06:30
parent 38ad7e463a
commit 8537c3f76e
8 changed files with 28 additions and 11 deletions

View File

@ -6,6 +6,14 @@ use Illuminate\Http\Request;
class PageController extends Controller class PageController extends Controller
{ {
public function redirect() {
$role = auth()->user()->role;
if($role != 'user') {
return redirect()->route('home')->with(['message' => 'Welcome to Admin Dashboard!']);
}else {
return redirect()->route('page.index')->with(['message' => 'Welcome to MangaDex!']);
}
}
public function contact() public function contact()
{ {
return view('contact'); return view('contact');

View File

@ -18,7 +18,7 @@ class RouteServiceProvider extends ServiceProvider
* *
* @var string * @var string
*/ */
public const HOME = "/"; public const HOME = "/redirect";
/** /**
* Define your route model bindings, pattern filters, and other route configuration. * Define your route model bindings, pattern filters, and other route configuration.

9
package-lock.json generated
View File

@ -1,9 +1,10 @@
{ {
"name": "mangaDex", "name": "MangaDex",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "MangaDex",
"dependencies": { "dependencies": {
"bootstrap-icons": "^1.10.5" "bootstrap-icons": "^1.10.5"
}, },
@ -751,9 +752,9 @@
} }
}, },
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.4.28", "version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.28.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-Z7V5j0cq8oEKyejIKfpD8b4eBy9cwW2JWPk0+fB1HOAMsfHbnAXLLS+PfVWlzMSLQaWttKDt607I0XHmpE67Vw==", "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {

View File

@ -4,6 +4,10 @@
<form method="POST" action="{{ route('genres.create') }}" enctype="multipart/form-data"> <form method="POST" action="{{ route('genres.create') }}" enctype="multipart/form-data">
@csrf @csrf
<div class="mb-3"> <div class="mb-3">
<div class="d-flex justify-content-between">
<h3>Create Your Genres Here</h3>
<a href="{{route('genres.index')}}" class="btn btn-primary">Go see Genre List</a>
</div> <hr>
<label for="">Genre Name</label> <label for="">Genre Name</label>
<input type="text" name="name" class="form-control"> <input type="text" name="name" class="form-control">
@error('name') @error('name')

View File

@ -2,7 +2,12 @@
@section('content') @section('content')
<x-card-card-body> <x-card-card-body>
<h5>Genres List</h5> <div class="d-flex justify-content-between align-items-center">
<h5>Genres List</h5>
<a href="{{route('genres.create')}}" class="btn btn-dark">
<i class="bi bi-plus-circle"></i>
</a>
</div>
<hr> <hr>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover table-striped"> <table class="table table-hover table-striped">

View File

@ -9,12 +9,9 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"> {{-- <li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{ route('page.index') }}">HOME</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{route('contact')}}">CONTACT US</a> <a class="nav-link" href="{{route('contact')}}">CONTACT US</a>
</li> </li> --}}
</ul> </ul>
<!-- search box --> <!-- search box -->

View File

@ -1,6 +1,7 @@
<!-- another nav--> <!-- another nav-->
<ul class="d-flex flex-wrap container mt-3"> <ul class="d-flex flex-wrap container mt-3">
<div class="d-flex flex-wrap"> <div class="d-flex flex-wrap">
<a class="list-group-item me-2" href="{{route('contact')}}">CONTACT US</a>
<a href="" class="list-group-item me-2">DISCORD</a> <a href="" class="list-group-item me-2">DISCORD</a>
<a href="" class="list-group-item me-2">PAYPAL</a> <a href="" class="list-group-item me-2">PAYPAL</a>
<a href="" class="list-group-item me-2">PATREON</a> <a href="" class="list-group-item me-2">PATREON</a>

View File

@ -32,6 +32,7 @@ Route::controller(MangaChapterController::class)->group(function () {
//contact page //contact page
Route::controller(PageController::class)->group(function(){ Route::controller(PageController::class)->group(function(){
Route::get('/contact', 'contact')->name('contact'); Route::get('/contact', 'contact')->name('contact');
Route::get('/redirect', 'redirect');
}); });
//comment and reply //comment and reply