changes
This commit is contained in:
parent
adfc826e9c
commit
5b3c44aa33
@ -18,7 +18,7 @@ class AuthenticationController extends Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->path = config('app.client_path');
|
$this->path = config('app.client_path');
|
||||||
$ads = Advertisements::where('status', 1)->where('parent_advertisement',0)->get();
|
$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();
|
$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();
|
$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();
|
$latestNews = News::where('status', 1)->inRandomOrder()->limit(4)->get();
|
||||||
@ -32,46 +32,39 @@ class AuthenticationController extends Controller
|
|||||||
|
|
||||||
public function login()
|
public function login()
|
||||||
{
|
{
|
||||||
return view($this->path.'.auth.login');
|
return view($this->path . '.auth.login');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
return view($this->path.'.auth.registration');
|
return view($this->path . '.auth.registration');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function store(Request $request)
|
public static function store(Request $request)
|
||||||
{
|
{
|
||||||
dd($request->all());
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
'password' => ['required', 'string', 'min:8'],
|
||||||
|
'phone' => ['required', 'integer'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
User::create([
|
User::create([
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'email' => $request->email,
|
'email' => $request->email,
|
||||||
'password' => bcrypt($request->password),
|
'password' => bcrypt($request->password),
|
||||||
'username' => $request->name
|
'username' => $request->name,
|
||||||
]);
|
'phone' => $request->phone,
|
||||||
|
'status' => 1,
|
||||||
|
'email_verified_at' => now()
|
||||||
|
])->assignRole('user');
|
||||||
|
|
||||||
$credentials = $request->only('email', 'password');
|
return response()->json(['success' => true, 'message' => 'User created successfully!', 'redirect_url' => route('userLogin')]);
|
||||||
if (Auth::attempt($credentials)) {
|
|
||||||
$request->session()->regenerate();
|
|
||||||
return response()->json([
|
|
||||||
'success' => true,
|
|
||||||
'message' => 'You have successfully logged in!',
|
|
||||||
'redirect_url' => route('home')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return response()->json([
|
|
||||||
'success' => false,
|
|
||||||
'message' => 'The provided credentials do not match our records.'
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function authenticate(Request $request){
|
|
||||||
|
public static function authenticate(Request $request)
|
||||||
|
{
|
||||||
$credentials = $request->validate([
|
$credentials = $request->validate([
|
||||||
'email' => ['required', 'string', 'email', 'max:255'],
|
'email' => ['required', 'string', 'email', 'max:255'],
|
||||||
'password' => ['required', 'string', 'min:8'],
|
'password' => ['required', 'string', 'min:8'],
|
||||||
@ -91,12 +84,12 @@ class AuthenticationController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function logout(Request $request){
|
public static function logout(Request $request)
|
||||||
|
{
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
$request->session()->regenerateToken();
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
return redirect()->route('userLogin');
|
return redirect()->route('userLogin');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ class NewscategoriesController extends Controller
|
|||||||
{
|
{
|
||||||
$this->modelService = new CommonModelService($model);
|
$this->modelService = new CommonModelService($model);
|
||||||
$this->newsCategoriesRepository = $newsCategoriesRepository;
|
$this->newsCategoriesRepository = $newsCategoriesRepository;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ class Kernel extends HttpKernel
|
|||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
\Illuminate\Routing\Middleware\ThrottleRequests::class . ':api',
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@ -64,5 +64,8 @@ class Kernel extends HttpKernel
|
|||||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||||
|
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
||||||
|
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ class User extends Authenticatable
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
|
'phone',
|
||||||
'username',
|
'username',
|
||||||
'password',
|
'password',
|
||||||
];
|
];
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->string('phone')->nullable()->after('username');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('phone');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -12,6 +12,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- End Page Banner -->
|
<!-- End Page Banner -->
|
||||||
|
|
||||||
<!-- Start Login Area -->
|
<!-- Start Login Area -->
|
||||||
@ -19,19 +21,20 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
<h2>लगइन फर्म</h2>
|
<h2>लगइन फर्म</h2>
|
||||||
<form>
|
<form id="login-form" action={{ route('postLogin') }} method="POST">
|
||||||
|
@csrf
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>युजरनेम</label>
|
<label>युजरनेम</label>
|
||||||
<input type="text" class="form-control" placeholder="युजरनेम">
|
<input type="text" class="form-control" placeholder="युजरनेम" id="email">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>पासवर्ड </label>
|
<label>पासवर्ड </label>
|
||||||
<input type="text" class="form-control" placeholder="पासवर्ड">
|
<input type="password" class="form-control" placeholder="पासवर्ड" id="password">
|
||||||
</div>
|
</div>
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" class="form-check-input" id="checkme">
|
<input type="checkbox" class="form-check-input" id="remember-me">
|
||||||
<label class="form-check-label" for="checkme"> याद राख्नुहोस</label>
|
<label class="form-check-label" for="checkme"> याद राख्नुहोस</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -48,7 +51,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="register-form">
|
<div class="register-form">
|
||||||
<h2>रजिस्टर</h2>
|
<h2>रजिस्टर</h2>
|
||||||
<form id="register-form" action={{ route('postresgistration') }} method="POST">
|
<form id="register-form" action={{ route('postresgistration') }}>
|
||||||
@csrf
|
@csrf
|
||||||
@method('POST')
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>नाम</label>
|
<label>नाम</label>
|
||||||
<input type="text" class="form-control" placeholder="नाम" id="name">
|
<input type="text" class="form-control" placeholder="नाम" id="name">
|
||||||
@ -36,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>पासवर्ड</label>
|
<label>पासवर्ड</label>
|
||||||
<input type="text" class="form-control" placeholder="पासवर्ड" id="password">
|
<input type="password" class="form-control" placeholder="पासवर्ड" id="password">
|
||||||
</div>
|
</div>
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
@ -58,6 +57,7 @@
|
|||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
$('#register-form').submit(function(e) {
|
$('#register-form').submit(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let form = $(this);
|
let form = $(this);
|
||||||
@ -65,6 +65,7 @@
|
|||||||
let email = $('#email').val();
|
let email = $('#email').val();
|
||||||
let password = $('#password').val();
|
let password = $('#password').val();
|
||||||
let phone = $('#phone').val();
|
let phone = $('#phone').val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: form.attr('action'),
|
url: form.attr('action'),
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -95,14 +96,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
let err = JSON.parse(xhr.responseText);
|
let err = xhr.responseJSON;
|
||||||
|
let errorMsg = 'An error occurred during the request.';
|
||||||
|
if (err.errors) {
|
||||||
|
errorMsg = Object.values(err.errors).map(errMsg => errMsg.join(', ')).join(' ');
|
||||||
|
}
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
text: err.message || 'An error occurred during the request.'
|
text: errorMsg
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
<script src="{{ asset('hulaki/assets/js/owl.carousel.min.js') }}"></script>
|
<script src="{{ asset('hulaki/assets/js/owl.carousel.min.js') }}"></script>
|
||||||
<!-- Magnific Popup JS -->
|
<!-- Magnific Popup JS -->
|
||||||
<script src="{{ asset('hulaki/assets/js/jquery.magnific-popup.min.js') }}"></script>
|
<script src="{{ asset('hulaki/assets/js/jquery.magnific-popup.min.js') }}"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="https://platform-api.sharethis.com/js/sharethis.js#property=61da909ca3f186001956822c&product=inline-share-buttons"
|
src="https://platform-api.sharethis.com/js/sharethis.js#property=61da909ca3f186001956822c&product=inline-share-buttons"
|
||||||
|
@ -40,10 +40,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@if (!auth()->check())
|
||||||
<li>
|
<li>
|
||||||
<i class='bx bx-user'></i>
|
<i class='bx bx-user'></i>
|
||||||
<a href="{{route('userLogin')}}">लगइन</a>
|
<a href="{{ route('userLogin') }}">लगइन</a>
|
||||||
</li>
|
</li>
|
||||||
|
@else
|
||||||
|
<li>
|
||||||
|
<i class='bx bx-user'></i>
|
||||||
|
<a href="#"><span class="fs-10">{{ auth()->user()->name }}</span> </a>
|
||||||
|
<i class='bx bx-power-off'></i>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -56,7 +64,7 @@
|
|||||||
<div class="main-responsive-nav">
|
<div class="main-responsive-nav">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<a href="{{route('home')}}">
|
<a href="{{ route('home') }}">
|
||||||
<img src="<?php echo asset(SITEVARS->primary_logo); ?>" class="black-logo" alt="image">
|
<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">
|
<img src="<?php echo asset(SITEVARS->secondary_logo); ?>" class="white-logo" alt="image">
|
||||||
</a>
|
</a>
|
||||||
@ -77,7 +85,7 @@
|
|||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<nav class="navbar navbar-expand-sm navbar-light">
|
<nav class="navbar navbar-expand-sm navbar-light">
|
||||||
<a class="navbar-brand" href="{{route('home')}}">
|
<a class="navbar-brand" href="{{ route('home') }}">
|
||||||
<img src="<?php echo asset(SITEVARS->primary_logo); ?>" class="black-logo" alt="image"
|
<img src="<?php echo asset(SITEVARS->primary_logo); ?>" class="black-logo" alt="image"
|
||||||
style="margin-left: -20px;max-width: 350px; height: auto; display: block;">
|
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;">
|
<img src="<?php echo asset(SITEVARS->secondary_logo); ?>" class="white-logo" alt="image" style="margin-left: -20px;">
|
||||||
|
@ -12,9 +12,9 @@ use App\Http\Controllers\Auth\VerifyEmailController;
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware('guest')->group(function () {
|
Route::middleware('guest')->group(function () {
|
||||||
// Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
|
Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
|
||||||
|
|
||||||
// Route::post('register', [RegisteredUserController::class, 'store']);
|
Route::post('register', [RegisteredUserController::class, 'store'])->name('register.store');
|
||||||
|
|
||||||
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
||||||
->name('login');
|
->name('login');
|
||||||
|
Loading…
Reference in New Issue
Block a user