Skip to content

Commit 35ee354

Browse files
committed
基本结构
1 parent 05eaa22 commit 35ee354

20 files changed

+882
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin\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+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
7+
8+
class LoginController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Login Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller handles authenticating users for the application and
16+
| redirecting them to your home screen. The controller uses a trait
17+
| to conveniently provide its functionality to your applications.
18+
|
19+
*/
20+
21+
use AuthenticatesUsers;
22+
23+
/**
24+
* Where to redirect users after login.
25+
*
26+
* @var string
27+
*/
28+
protected $redirectTo = '/home';
29+
30+
/**
31+
* Create a new controller instance.
32+
*
33+
* @return void
34+
*/
35+
public function __construct()
36+
{
37+
$this->middleware('guest', ['except' => 'logout']);
38+
}
39+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin\Auth;
4+
5+
use App\User;
6+
use Validator;
7+
use App\Http\Controllers\Controller;
8+
use Illuminate\Foundation\Auth\RegistersUsers;
9+
10+
class RegisterController extends Controller
11+
{
12+
/*
13+
|--------------------------------------------------------------------------
14+
| Register Controller
15+
|--------------------------------------------------------------------------
16+
|
17+
| This controller handles the registration of new users as well as their
18+
| validation and creation. By default this controller uses a trait to
19+
| provide this functionality without requiring any additional code.
20+
|
21+
*/
22+
23+
use RegistersUsers;
24+
25+
/**
26+
* Where to redirect users after login / registration.
27+
*
28+
* @var string
29+
*/
30+
protected $redirectTo = '/home';
31+
32+
/**
33+
* Create a new controller instance.
34+
*
35+
* @return void
36+
*/
37+
public function __construct()
38+
{
39+
$this->middleware('guest');
40+
}
41+
42+
/**
43+
* Get a validator for an incoming registration request.
44+
*
45+
* @param array $data
46+
* @return \Illuminate\Contracts\Validation\Validator
47+
*/
48+
protected function validator(array $data)
49+
{
50+
return Validator::make($data, [
51+
'name' => 'required|max:255',
52+
'email' => 'required|email|max:255|unique:users',
53+
'password' => 'required|min:6|confirmed',
54+
]);
55+
}
56+
57+
/**
58+
* Create a new user instance after a valid registration.
59+
*
60+
* @param array $data
61+
* @return User
62+
*/
63+
protected function create(array $data)
64+
{
65+
return User::create([
66+
'name' => $data['name'],
67+
'email' => $data['email'],
68+
'password' => bcrypt($data['password']),
69+
]);
70+
}
71+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class ResetPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
}
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\Admin;
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\Http\Response
23+
*/
24+
public function index()
25+
{
26+
return view('home');
27+
}
28+
}
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\Http\Response
23+
*/
24+
public function index()
25+
{
26+
return view('home');
27+
}
28+
}

app/User.php renamed to app/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App;
3+
namespace App\Models;
44

55
use Illuminate\Notifications\Notifiable;
66
use Illuminate\Foundation\Auth\User as Authenticatable;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-md-8 col-md-offset-2">
7+
<div class="panel panel-default">
8+
<div class="panel-heading">Login</div>
9+
<div class="panel-body">
10+
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
11+
{{ csrf_field() }}
12+
13+
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
14+
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
15+
16+
<div class="col-md-6">
17+
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
18+
19+
@if ($errors->has('email'))
20+
<span class="help-block">
21+
<strong>{{ $errors->first('email') }}</strong>
22+
</span>
23+
@endif
24+
</div>
25+
</div>
26+
27+
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
28+
<label for="password" class="col-md-4 control-label">Password</label>
29+
30+
<div class="col-md-6">
31+
<input id="password" type="password" class="form-control" name="password" required>
32+
33+
@if ($errors->has('password'))
34+
<span class="help-block">
35+
<strong>{{ $errors->first('password') }}</strong>
36+
</span>
37+
@endif
38+
</div>
39+
</div>
40+
41+
<div class="form-group">
42+
<div class="col-md-6 col-md-offset-4">
43+
<div class="checkbox">
44+
<label>
45+
<input type="checkbox" name="remember"> Remember Me
46+
</label>
47+
</div>
48+
</div>
49+
</div>
50+
51+
<div class="form-group">
52+
<div class="col-md-8 col-md-offset-4">
53+
<button type="submit" class="btn btn-primary">
54+
Login
55+
</button>
56+
57+
<a class="btn btn-link" href="{{ url('/password/reset') }}">
58+
Forgot Your Password?
59+
</a>
60+
</div>
61+
</div>
62+
</form>
63+
</div>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
@endsection
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
@extends('layouts.app')
2+
3+
<!-- Main Content -->
4+
@section('content')
5+
<div class="container">
6+
<div class="row">
7+
<div class="col-md-8 col-md-offset-2">
8+
<div class="panel panel-default">
9+
<div class="panel-heading">Reset Password</div>
10+
<div class="panel-body">
11+
@if (session('status'))
12+
<div class="alert alert-success">
13+
{{ session('status') }}
14+
</div>
15+
@endif
16+
17+
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
18+
{{ csrf_field() }}
19+
20+
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
21+
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
22+
23+
<div class="col-md-6">
24+
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
25+
26+
@if ($errors->has('email'))
27+
<span class="help-block">
28+
<strong>{{ $errors->first('email') }}</strong>
29+
</span>
30+
@endif
31+
</div>
32+
</div>
33+
34+
<div class="form-group">
35+
<div class="col-md-6 col-md-offset-4">
36+
<button type="submit" class="btn btn-primary">
37+
Send Password Reset Link
38+
</button>
39+
</div>
40+
</div>
41+
</form>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
</div>
47+
@endsection

0 commit comments

Comments
 (0)