Skip to content

Commit 8ff5fdd

Browse files
committed
#17 Upgrading Laravel to 5.1.*
1 parent cf24331 commit 8ff5fdd

File tree

8 files changed

+59
-72
lines changed

8 files changed

+59
-72
lines changed
Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
<?php namespace Todo\Http\Controllers\Auth;
1+
<?php
22

3+
namespace Todo\Http\Controllers\Auth;
4+
5+
use Todo\User;
6+
use Validator;
37
use Todo\Http\Controllers\Controller;
4-
use Illuminate\Contracts\Auth\Guard;
5-
use Illuminate\Contracts\Auth\Registrar;
68
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
79

8-
class AuthController extends Controller {
9-
10+
class AuthController extends Controller
11+
{
1012
/*
1113
|--------------------------------------------------------------------------
1214
| Registration & Login Controller
@@ -23,16 +25,40 @@ class AuthController extends Controller {
2325
/**
2426
* Create a new authentication controller instance.
2527
*
26-
* @param \Illuminate\Contracts\Auth\Guard $auth
27-
* @param \Illuminate\Contracts\Auth\Registrar $registrar
2828
* @return void
2929
*/
30-
public function __construct(Guard $auth, Registrar $registrar)
30+
public function __construct()
3131
{
32-
$this->auth = $auth;
33-
$this->registrar = $registrar;
34-
3532
$this->middleware('guest', ['except' => 'getLogout']);
3633
}
3734

38-
}
35+
/**
36+
* Get a validator for an incoming registration request.
37+
*
38+
* @param array $data
39+
* @return \Illuminate\Contracts\Validation\Validator
40+
*/
41+
public function validator(array $data)
42+
{
43+
return Validator::make($data, [
44+
'name' => 'required|max:255',
45+
'email' => 'required|email|max:255|unique:users',
46+
'password' => 'required|confirmed|min:6',
47+
]);
48+
}
49+
50+
/**
51+
* Create a new user instance after a valid registration.
52+
*
53+
* @param array $data
54+
* @return User
55+
*/
56+
public function create(array $data)
57+
{
58+
return User::create([
59+
'name' => $data['name'],
60+
'email' => $data['email'],
61+
'password' => bcrypt($data['password']),
62+
]);
63+
}
64+
}
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<?php namespace Todo\Http\Controllers\Auth;
1+
<?php
2+
3+
namespace Todo\Http\Controllers\Auth;
24

35
use Todo\Http\Controllers\Controller;
4-
use Illuminate\Contracts\Auth\Guard;
5-
use Illuminate\Contracts\Auth\PasswordBroker;
66
use Illuminate\Foundation\Auth\ResetsPasswords;
77

8-
class PasswordController extends Controller {
9-
8+
class PasswordController extends Controller
9+
{
1010
/*
1111
|--------------------------------------------------------------------------
1212
| Password Reset Controller
@@ -23,16 +23,10 @@ class PasswordController extends Controller {
2323
/**
2424
* Create a new password controller instance.
2525
*
26-
* @param \Illuminate\Contracts\Auth\Guard $auth
27-
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
2826
* @return void
2927
*/
30-
public function __construct(Guard $auth, PasswordBroker $passwords)
28+
public function __construct()
3129
{
32-
$this->auth = $auth;
33-
$this->passwords = $passwords;
34-
3530
$this->middleware('guest');
3631
}
37-
38-
}
32+
}

app/Services/Registrar.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

bootstrap/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
|
2828
*/
2929

30-
$compiledPath = __DIR__.'/../storage/framework/compiled.php';
30+
$compiledPath = __DIR__.'/cache/compiled.php';
3131

3232
if (file_exists($compiledPath))
3333
{

bootstrap/cache/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"type": "project",
77
"require": {
8-
"laravel/framework": "5.0.*",
9-
"tymon/jwt-auth": "0.5.*"
8+
"laravel/framework": "5.1.*",
9+
"tymon/jwt-auth": "0.5.*"
1010
},
1111
"require-dev": {
1212
"phpunit/phpunit": "~4.0",

config/app.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
'Illuminate\Translation\TranslationServiceProvider',
136136
'Illuminate\Validation\ValidationServiceProvider',
137137
'Illuminate\View\ViewServiceProvider',
138+
'Illuminate\Broadcasting\BroadcastServiceProvider',
138139

139140
/*
140141
* Application Service Providers...
@@ -144,10 +145,11 @@
144145
'Todo\Providers\ConfigServiceProvider',
145146
'Todo\Providers\EventServiceProvider',
146147
'Todo\Providers\RouteServiceProvider',
147-
/*
148-
* JSON Web Token (Authentication)
149-
*/
150-
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',
148+
149+
/*
150+
* JSON Web Token (Authentication)
151+
*/
152+
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider',
151153

152154
],
153155

@@ -196,7 +198,7 @@
196198
'URL' => 'Illuminate\Support\Facades\URL',
197199
'Validator' => 'Illuminate\Support\Facades\Validator',
198200
'View' => 'Illuminate\Support\Facades\View',
199-
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
201+
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
200202

201203
],
202204

tests/TestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
class TestCase extends Illuminate\Foundation\Testing\TestCase {
44

5+
protected $baseUrl = 'http://localhost';
6+
57
/**
68
* Creates the application.
79
*

0 commit comments

Comments
 (0)