Skip to content

Commit 15ac760

Browse files
✨ Add Laravel ui to application
1 parent 9627adb commit 15ac760

25 files changed

+18423
-12
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\ConfirmsPasswords;
8+
9+
class ConfirmPasswordController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Confirm Password Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling password confirmations and
17+
| uses a simple trait to include the behavior. You're free to explore
18+
| this trait and override any functions that require customization.
19+
|
20+
*/
21+
22+
use ConfirmsPasswords;
23+
24+
/**
25+
* Where to redirect users when the intended url fails.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('auth');
39+
}
40+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
8+
9+
class LoginController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Login Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller handles authenticating users for the application and
17+
| redirecting them to your home screen. The controller uses a trait
18+
| to conveniently provide its functionality to your applications.
19+
|
20+
*/
21+
22+
use AuthenticatesUsers;
23+
24+
/**
25+
* Where to redirect users after login.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('guest')->except('logout');
39+
$this->user = new User;
40+
}
41+
42+
43+
public function login(Request $request)
44+
{
45+
$this->validate($request, [
46+
'mobileno' => 'required|regex:/[0-9]{10}/|digits:10',
47+
48+
]);
49+
50+
$user = User::where('mobileno', $request->get('mobileno'))->first();
51+
52+
if($request->get('mobileno') != $user->mobileno) {
53+
\Session::put('errors', 'Please Register First mobile number.!!');
54+
return back();
55+
}
56+
57+
\Auth::login($user);
58+
59+
return redirect()->route('home');
60+
61+
}
62+
63+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use App\Models\User;
8+
use Illuminate\Foundation\Auth\RegistersUsers;
9+
use Illuminate\Support\Facades\Hash;
10+
use Illuminate\Support\Facades\Validator;
11+
12+
class RegisterController extends Controller
13+
{
14+
/*
15+
|--------------------------------------------------------------------------
16+
| Register Controller
17+
|--------------------------------------------------------------------------
18+
|
19+
| This controller handles the registration of new users as well as their
20+
| validation and creation. By default this controller uses a trait to
21+
| provide this functionality without requiring any additional code.
22+
|
23+
*/
24+
25+
use RegistersUsers;
26+
27+
/**
28+
* Where to redirect users after registration.
29+
*
30+
* @var string
31+
*/
32+
protected $redirectTo = RouteServiceProvider::HOME;
33+
34+
/**
35+
* Create a new controller instance.
36+
*
37+
* @return void
38+
*/
39+
public function __construct()
40+
{
41+
$this->middleware('guest');
42+
}
43+
44+
/**
45+
* Get a validator for an incoming registration request.
46+
*
47+
* @param array $data
48+
* @return \Illuminate\Contracts\Validation\Validator
49+
*/
50+
protected function validator(array $data)
51+
{
52+
return Validator::make($data, [
53+
'name' => ['required', 'string', 'max:255'],
54+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
55+
'password' => ['required', 'string', 'min:8', 'confirmed'],
56+
]);
57+
}
58+
59+
/**
60+
* Create a new user instance after a valid registration.
61+
*
62+
* @param array $data
63+
* @return \App\Models\User
64+
*/
65+
protected function create(array $data)
66+
{
67+
return User::create([
68+
'name' => $data['name'],
69+
'email' => $data['email'],
70+
'password' => Hash::make($data['password']),
71+
]);
72+
}
73+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\ResetsPasswords;
8+
9+
class ResetPasswordController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Password Reset Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling password reset requests
17+
| and uses a simple trait to include this behavior. You're free to
18+
| explore this trait and override any methods you wish to tweak.
19+
|
20+
*/
21+
22+
use ResetsPasswords;
23+
24+
/**
25+
* Where to redirect users after resetting their password.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Foundation\Auth\VerifiesEmails;
8+
9+
class VerificationController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Email Verification Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller is responsible for handling email verification for any
17+
| user that recently registered with the application. Emails may also
18+
| be re-sent if the user didn't receive the original email message.
19+
|
20+
*/
21+
22+
use VerifiesEmails;
23+
24+
/**
25+
* Where to redirect users after verification.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = RouteServiceProvider::HOME;
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('auth');
39+
$this->middleware('signed')->only('verify');
40+
$this->middleware('throttle:6,1')->only('verify', 'resend');
41+
}
42+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
class HomeController extends Controller
8+
{
9+
/**
10+
* Create a new controller instance.
11+
*
12+
* @return void
13+
*/
14+
public function __construct()
15+
{
16+
$this->middleware('auth');
17+
}
18+
19+
/**
20+
* Show the application dashboard.
21+
*
22+
* @return \Illuminate\Contracts\Support\Renderable
23+
*/
24+
public function index()
25+
{
26+
return view('home');
27+
}
28+
}

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99

1010
class RedirectIfAuthenticated
1111
{
12-
/**
13-
* Handle an incoming request.
14-
*
15-
* @param \Illuminate\Http\Request $request
16-
* @param \Closure $next
17-
* @param string|null ...$guards
18-
* @return mixed
19-
*/
2012
public function handle(Request $request, Closure $next, ...$guards)
2113
{
2214
$guards = empty($guards) ? [null] : $guards;

0 commit comments

Comments
 (0)