From 1d2790b4219d56816adf425582e8b3948dcdd821 Mon Sep 17 00:00:00 2001 From: imadhigp Date: Wed, 8 Jul 2026 10:54:41 +0530 Subject: [PATCH] 2nd push --- app/Http/Controllers/AuthController.php | 91 +++++ app/Models/User.php | 12 +- .../0001_01_01_000000_create_users_table.php | 6 +- resources/views/abouts.blade.php | 9 +- resources/views/apply.blade.php | 71 +++- resources/views/contacts.blade.php | 24 +- resources/views/courses.blade.php | 22 +- resources/views/layouts/app.blade.php | 376 +++++++++++------- resources/views/layouts/blank.blade.php | 111 ++++++ resources/views/signin.blade.php | 233 +++++++++++ resources/views/signup.blade.php | 220 ++++++++++ resources/views/welcome.blade.php | 34 +- routes/web.php | 31 +- 13 files changed, 1063 insertions(+), 177 deletions(-) create mode 100644 app/Http/Controllers/AuthController.php create mode 100644 resources/views/layouts/blank.blade.php create mode 100644 resources/views/signin.blade.php create mode 100644 resources/views/signup.blade.php diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php new file mode 100644 index 0000000..446e291 --- /dev/null +++ b/app/Http/Controllers/AuthController.php @@ -0,0 +1,91 @@ +validate([ + 'first_name' => 'required|string|max:255', + 'last_name' => 'required|string|max:255', + 'email' => 'required|string|email|max:255|unique:users', + 'phone' => 'required|string|max:15', + 'password' => 'required|string|min:8|confirmed', + ]); + + $user = User::create([ + 'first_name' => $request->first_name, + 'last_name' => $request->last_name, + 'email' => $request->email, + 'phone' => $request->phone, + 'password' => Hash::make($request->password), + ]); + + // Automatically logs the new user in + Auth::login($user); + + // FIX: Changed redirect from '/signin' to '/' because they are already logged in + return redirect('/')->with('success', 'Registration successful! Welcome to your dashboard.'); + } + + /** + * Handle Student Login (POST) + */ + public function login(Request $request) + { + $credentials = $request->validate([ + 'email' => 'required|email', + 'password' => 'required|string', + ]); + + if (Auth::attempt($credentials)) { + $request->session()->regenerate(); + + return redirect()->intended('/')->with('success', 'Welcome back!'); + } + + return back()->withErrors([ + 'email' => 'The provided credentials do not match our records.', + ])->onlyInput('email'); + } + + /** + * Handle Async Logout (POST Fetch) + */ + public function logout(Request $request) // FIX: Restored Request injection + { + try { + if (Auth::check()) { + Auth::logout(); + } + + // Flush old fallback explicit keys + $request->session()->forget(['user_id', 'user_name']); + + if ($request->session()->isStarted()) { + $request->session()->invalidate(); + $request->session()->regenerateToken(); + } + + return response()->json(['success' => true]); + + } catch (\Exception $e) { + Log::error('Logout Server Error: ' . $e->getMessage()); + + if (isset($_SESSION)) { + session_destroy(); + } + return response()->json(['success' => true, 'forced' => true]); + } + } +} \ No newline at end of file diff --git a/app/Models/User.php b/app/Models/User.php index 68f3a66..414254f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -18,11 +18,13 @@ class User extends Authenticatable * * @var list */ - protected $fillable = [ - 'name', - 'email', - 'password', - ]; + protected $fillable = [ + 'first_name', + 'last_name', + 'email', + 'phone', + 'password', +]; /** * The attributes that should be hidden for serialization. diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 05fb5d9..24a159b 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -13,8 +13,10 @@ return new class extends Migration { Schema::create('users', function (Blueprint $table) { $table->id(); - $table->string('name'); + $table->string('first_name'); + $table->string('last_name'); $table->string('email')->unique(); + $table->string('phone'); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); @@ -46,4 +48,4 @@ return new class extends Migration Schema::dropIfExists('password_reset_tokens'); Schema::dropIfExists('sessions'); } -}; +}; \ No newline at end of file diff --git a/resources/views/abouts.blade.php b/resources/views/abouts.blade.php index 9722d33..b434d7c 100644 --- a/resources/views/abouts.blade.php +++ b/resources/views/abouts.blade.php @@ -163,9 +163,12 @@ Industry-recognized certifications to boost your career. Join our institute and become a skilled automotive professional.

- -Student Portal - + + +
+ + Apply Courses +
diff --git a/resources/views/apply.blade.php b/resources/views/apply.blade.php index 82abfcd..1065686 100644 --- a/resources/views/apply.blade.php +++ b/resources/views/apply.blade.php @@ -46,7 +46,7 @@ } .form-header { - background: var(--primary); + background: #887582; color: white; padding: 25px 40px; } @@ -57,7 +57,7 @@ } .section-title { - background: #0B3B70; + background: #887582; color: white; padding: 14px 20px; margin-top: 40px; @@ -138,7 +138,19 @@ + +
+ + +
+ + +
+ + +
+
+
@@ -159,13 +172,36 @@
+
+ + +
+ +
+ + +
+ +
+ + +
+ + +
-
+ + + + +
+ Education
+ + +
+ + +
+ + + + + +
Qualifications
-
-
- - -
-
Emergency Contacts diff --git a/resources/views/contacts.blade.php b/resources/views/contacts.blade.php index 32096ce..b947e78 100644 --- a/resources/views/contacts.blade.php +++ b/resources/views/contacts.blade.php @@ -40,7 +40,7 @@ .btn-contact{ background:var(--primary); color:#fff; - border-radius:30px; + /* border-radius:30px; */ padding:10px 30px; } @@ -153,15 +153,25 @@ Send Message
+ + +
diff --git a/resources/views/courses.blade.php b/resources/views/courses.blade.php index ab90780..1e39be2 100644 --- a/resources/views/courses.blade.php +++ b/resources/views/courses.blade.php @@ -11,14 +11,24 @@ --light:#f8f4f7; } -.hero{ +/* .hero{ background:linear-gradient(rgba(0,0,0,.65),rgba(0,0,0,.65)), - url('https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?auto=format&fit=crop&w=1600&q=80'); + url(https://images.unsplash.com/photo-1486006920555-c77dce18193b?auto=format&fit=crop&w=1600&q=80); background-size:cover; background-position:center; color:#fff; padding:120px 0; text-align:center; +} */ + .hero { + background-image: linear-gradient(rgba(135, 125, 145, 0.65), rgba(0, 0, 0, 0.65)), + url('https://images.unsplash.com/photo-1486006920555-c77dce18193b?auto=format&fit=crop&w=1600&q=80'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + color: #fff; + padding: 120px 0; + text-align: center; } .hero h1{ @@ -50,11 +60,12 @@ } .badge-course{ - background:var(--primary); + background:#887582; color:#fff; padding:8px 15px; border-radius:30px; font-size:13px; + font-weight:30px; } .read-btn{ @@ -62,6 +73,7 @@ color:#fff; border-radius:30px; padding:10px 25px; + font-weight: 40px; } .read-btn:hover{ @@ -186,8 +198,8 @@ $courses=[
- -View Details + +Apply Course
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 74ab313..f51a4a5 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -3,181 +3,243 @@ - @yield('title','Automobile Academic') + + @yield('title', 'Automobile Academic') - - - + + + .site-footer hr { + border-color: rgba(255,255,255,.15); + margin: 40px 0 20px; + } + .footer-bottom { + color: #b8a6b3; + font-size: 14px; + } + + .animate { + animation-duration: 0.2s; + animation-fill-mode: both; + } + + @keyframes slideIn { + 0% { + transform: translateY(1rem); + opacity: 0; + } + 100% { + transform: translateY(0rem); + opacity: 1; + } + } + + .slideIn { + animation-name: slideIn; + } + - -@yield('content') - - +
+ @yield('content') +
-
-

Automobile Academic

-

- Providing excellence in Automotive Engineering Education, - Innovation and Research. -

+

Providing excellence in Automotive Engineering Education, Innovation and Research.

@@ -209,7 +271,6 @@ data-bs-target="#menu">
-

@@ -217,12 +278,57 @@ data-bs-target="#menu"> -
+ - + \ No newline at end of file diff --git a/resources/views/layouts/blank.blade.php b/resources/views/layouts/blank.blade.php new file mode 100644 index 0000000..8a121b4 --- /dev/null +++ b/resources/views/layouts/blank.blade.php @@ -0,0 +1,111 @@ + + + + + + + + + @yield('title', 'Automobile Engineering Academy') + + + + + + + + + + + + + + + + @stack('styles') + + + + + + + + @yield('content') + + + + + + + + + + + + + + + + + @stack('scripts') + + + + \ No newline at end of file diff --git a/resources/views/signin.blade.php b/resources/views/signin.blade.php new file mode 100644 index 0000000..d6dae99 --- /dev/null +++ b/resources/views/signin.blade.php @@ -0,0 +1,233 @@ +@extends('layouts.blank') + +@section('title', 'Student Login') + +@push('styles') + +@endpush + +@section('content') +
+
+ + + +
+
+

Student Sign In

+ +
+ @csrf + +
+ + + @error('email') + {{ $message }} + @enderror +
+ +
+ + + @error('password') + {{ $message }} + @enderror +
+ + + + + + + + + +
+
+
+ +
+
+@endsection \ No newline at end of file diff --git a/resources/views/signup.blade.php b/resources/views/signup.blade.php new file mode 100644 index 0000000..821dd5a --- /dev/null +++ b/resources/views/signup.blade.php @@ -0,0 +1,220 @@ +@extends('layouts.blank') + +@section('title', 'Student Registration') + +@push('styles') + +@endpush + +@section('content') + +
+
+ + + +
+ +
+ +

+ Student Registration +

+ +
+ @csrf + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+

Already have an account?

+ + + + Sign In + +
+ +
+ +
+ +
+ +
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 6c9b7ac..24c1879 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -80,14 +80,26 @@ body{ font-family: Arial, Helvetica, sans-serif; } -.hero{ - height:700px; +/* .hero{ + height:650px; background: linear-gradient(rgba(30,10,25,.65),rgba(30,10,25,.65)), - url('https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1600&q=80'); - background-size:cover; + url('https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1600&q=80'); */ + /* background-size:cover; background-position:center; -} +} */ + + + .hero { +height:650px; +background: +linear-gradient(rgba(30,10,25,.65),rgba(30,10,25,.65)), +url('https://images.unsplash.com/photo-1517524206127-48bbd363f3d7?auto=format&fit=crop&w=1600&q=80'); +background-size: cover; +background-position: center; +} + + .hero-content{ height:100%; @@ -102,6 +114,7 @@ body{ font-size:60px; font-weight:700; font-family: Arial, Helvetica, sans-serif; + margin-top: 75px; } .hero p{ @@ -222,11 +235,10 @@ h6{
-

+

Automobile Engineering Academy

-

Driving Innovation Through Education, Research & Technology

@@ -319,10 +331,18 @@ h6{ View Course
+
+ @endforeach + +
+ + View all courses + +
diff --git a/routes/web.php b/routes/web.php index ae21fe1..0d27fc2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,18 +1,41 @@ name('apply'); - Route::view('/courses', 'courses')->name('courses'); - Route::view('/students', 'students')->name('students'); - Route::view('/abouts', 'abouts')->name('abouts'); +Route::view('/contact', 'contacts')->name('contact'); -Route::view('/contact', 'contacts')->name('contact'); \ No newline at end of file + +Route::view('/signin', 'signin')->name('signin'); +Route::view('/signup', 'signup')->name('signup'); + + + + +// Route::get('/signup', function () { +// return view('signup'); +// })->name('signup'); \ No newline at end of file