Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 341aa19

Browse files
Changes for Laravel 5.2
1 parent 1f922a0 commit 341aa19

File tree

9 files changed

+162
-150
lines changed

9 files changed

+162
-150
lines changed

‎app/Exceptions/Handler.php‎

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,54 @@
11
<?php namespace App\Exceptions;
22

33
use Exception;
4+
use Illuminate\Auth\Access\AuthorizationException;
5+
use Illuminate\Database\Eloquent\ModelNotFoundException;
46
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
7+
use Illuminate\Foundation\Validation\ValidationException;
8+
use Symfony\Component\HttpKernel\Exception\HttpException;
59

6-
class Handler extends ExceptionHandler {
10+
class Handler extends ExceptionHandler
11+
{
712

8-
/**
9-
* A list of the exception types that should not be reported.
10-
*
11-
* @var array
12-
*/
13-
protected $dontReport = [
14-
'Symfony\Component\HttpKernel\Exception\HttpException'
15-
];
13+
/**
14+
* A list of the exception types that should not be reported.
15+
*
16+
* @var array
17+
*/
18+
protected $dontReport = [
19+
AuthorizationException::class,
20+
HttpException::class,
21+
ModelNotFoundException::class,
22+
ValidationException::class,
23+
];
1624

17-
/**
18-
* Report or log an exception.
19-
*
20-
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
21-
*
22-
* @param \Exception $e
23-
* @return void
24-
*/
25-
public function report(Exception $e)
26-
{
27-
return parent::report($e);
28-
}
25+
/**
26+
* Report or log an exception.
27+
*
28+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
29+
*
30+
* @param \Exception $e
31+
* @return void
32+
*/
33+
public function report(Exception $e)
34+
{
35+
return parent::report($e);
36+
}
2937

30-
/**
31-
* Render an exception into an HTTP response.
32-
*
33-
* @param \Illuminate\Http\Request $request
34-
* @param \Exception $e
35-
* @return \Illuminate\Http\Response
36-
*/
37-
public function render($request, Exception $e)
38-
{
39-
if ($this->isHttpException($e))
40-
{
41-
return $this->renderHttpException($e);
42-
}
43-
else
44-
{
45-
return parent::render($request, $e);
46-
}
47-
}
38+
/**
39+
* Render an exception into an HTTP response.
40+
*
41+
* @param \Illuminate\Http\Request $request
42+
* @param \Exception $e
43+
* @return \Illuminate\Http\Response
44+
*/
45+
public function render($request, Exception $e)
46+
{
47+
if ($this->isHttpException($e)) {
48+
return $this->renderHttpException($e);
49+
} else {
50+
return parent::render($request, $e);
51+
}
52+
}
4853

4954
}

‎app/Http/Controllers/HomeController.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function validation(Request $request)
103103
{
104104
$this->validate($request, [
105105
'post_id' => 'required|exists:posts,id',
106-
'postal_code' => 'required'
106+
'postal_code' => 'required|postal_code'
107107
]);
108108

109109
return 'Validation success';

‎app/Providers/BusServiceProvider.php‎

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

‎composer.json‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
}
1212
],
1313
"require": {
14-
"laravel/framework": "~5.1",
15-
"illuminate/html": "~5.0",
14+
"laravel/framework": "5.2.*",
15+
"laravelcollective/html": "5.2.*",
1616
"flow/jsonpath": "^0.2.4",
1717
"fzaninotto/faker": "~1.4"
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "~4.0",
2121
"phpspec/phpspec": "~2.1",
22-
"codeception/codeception": "2.1.x-dev"
22+
"codeception/codeception": "2.1.x-dev",
23+
"symfony/dom-crawler": "~3.0",
24+
"symfony/css-selector": "~3.0"
2325
},
2426
"autoload": {
2527
"classmap": [

‎config/app.php‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
return [
44

55
/*
6+
|--------------------------------------------------------------------------
7+
| Application Environment
8+
|--------------------------------------------------------------------------
9+
|
10+
| This value determines the "environment" your application is currently
11+
| running in. This may determine how you prefer to configure various
12+
| services your application utilizes. Set this in your ".env" file.
13+
|
14+
*/
15+
'env' => env('APP_ENV', 'production'),
16+
17+
/*
618
|--------------------------------------------------------------------------
719
| Application Debug Mode
820
|--------------------------------------------------------------------------
@@ -113,12 +125,10 @@
113125
/*
114126
* Laravel Framework Service Providers...
115127
*/
116-
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
117128
'Illuminate\Auth\AuthServiceProvider',
118129
'Illuminate\Bus\BusServiceProvider',
119130
'Illuminate\Cache\CacheServiceProvider',
120131
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
121-
'Illuminate\Routing\ControllerServiceProvider',
122132
'Illuminate\Cookie\CookieServiceProvider',
123133
'Illuminate\Database\DatabaseServiceProvider',
124134
'Illuminate\Encryption\EncryptionServiceProvider',
@@ -140,12 +150,11 @@
140150
* Application Service Providers...
141151
*/
142152
'App\Providers\AppServiceProvider',
143-
'App\Providers\BusServiceProvider',
144153
'App\Providers\ConfigServiceProvider',
145154
'App\Providers\EventServiceProvider',
146155
'App\Providers\RouteServiceProvider',
147156

148-
'Illuminate\Html\HtmlServiceProvider',
157+
'Collective\Html\HtmlServiceProvider',
149158
],
150159

151160
/*
@@ -194,8 +203,8 @@
194203
'Validator' => 'Illuminate\Support\Facades\Validator',
195204
'View' => 'Illuminate\Support\Facades\View',
196205

197-
'Html' => 'Illuminate\Html\HtmlFacade',
198-
'Form' => 'Illuminate\Html\FormFacade'
206+
'Html' => 'Collective\Html\HtmlFacade',
207+
'Form' => 'Collective\Html\FormFacade'
199208
],
200209

201210
];

‎config/auth.php‎

Lines changed: 94 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,96 @@
1-
<?php
21

2+
<?php
33
return [
4-
5-
/*
6-
|--------------------------------------------------------------------------
7-
| Default Authentication Driver
8-
|--------------------------------------------------------------------------
9-
|
10-
| This option controls the authentication driver that will be utilized.
11-
| This driver manages the retrieval and authentication of the users
12-
| attempting to get access to protected areas of your application.
13-
|
14-
| Supported: "database", "eloquent"
15-
|
16-
*/
17-
18-
'driver' => 'eloquent',
19-
20-
/*
21-
|--------------------------------------------------------------------------
22-
| Authentication Model
23-
|--------------------------------------------------------------------------
24-
|
25-
| When using the "Eloquent" authentication driver, we need to know which
26-
| Eloquent model should be used to retrieve your users. Of course, it
27-
| is often just the "User" model but you may use whatever you like.
28-
|
29-
*/
30-
31-
'model' => 'App\User',
32-
33-
/*
34-
|--------------------------------------------------------------------------
35-
| Authentication Table
36-
|--------------------------------------------------------------------------
37-
|
38-
| When using the "Database" authentication driver, we need to know which
39-
| table should be used to retrieve your users. We have chosen a basic
40-
| default value but you may easily change it to any table you like.
41-
|
42-
*/
43-
44-
'table' => 'users',
45-
46-
/*
47-
|--------------------------------------------------------------------------
48-
| Password Reset Settings
49-
|--------------------------------------------------------------------------
50-
|
51-
| Here you may set the options for resetting passwords including the view
52-
| that is your password reset e-mail. You can also set the name of the
53-
| table that maintains all of the reset tokens for your application.
54-
|
55-
| The expire time is the number of minutes that the reset token should be
56-
| considered valid. This security feature keeps tokens short-lived so
57-
| they have less time to be guessed. You may change this as needed.
58-
|
59-
*/
60-
61-
'password' => [
62-
'email' => 'emails.password',
63-
'table' => 'password_resets',
64-
'expire' => 60,
65-
],
66-
67-
];
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Authentication Defaults
7+
|--------------------------------------------------------------------------
8+
|
9+
| This option controls the default authentication "guard" and password
10+
| reset options for your application. You may change these defaults
11+
| as required, but they're a perfect start for most applications.
12+
|
13+
*/
14+
'defaults' => [
15+
'guard' => 'web',
16+
'passwords' => 'users',
17+
],
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Authentication Guards
21+
|--------------------------------------------------------------------------
22+
|
23+
| Next, you may define every authentication guard for your application.
24+
| Of course, a great default configuration has been defined for you
25+
| here which uses session storage and the Eloquent user provider.
26+
|
27+
| All authentication drivers have a user provider. This defines how the
28+
| users are actually retrieved out of your database or other storage
29+
| mechanisms used by this application to persist your user's data.
30+
|
31+
| Supported: "session", "token"
32+
|
33+
*/
34+
'guards' => [
35+
'web' => [
36+
'driver' => 'session',
37+
'provider' => 'users',
38+
],
39+
'api' => [
40+
'driver' => 'token',
41+
'provider' => 'users',
42+
],
43+
],
44+
/*
45+
|--------------------------------------------------------------------------
46+
| User Providers
47+
|--------------------------------------------------------------------------
48+
|
49+
| All authentication drivers have a user provider. This defines how the
50+
| users are actually retrieved out of your database or other storage
51+
| mechanisms used by this application to persist your user's data.
52+
|
53+
| If you have multiple user tables or models you may configure multiple
54+
| sources which represent each model / table. These sources may then
55+
| be assigned to any extra authentication guards you have defined.
56+
|
57+
| Supported: "database", "eloquent"
58+
|
59+
*/
60+
'providers' => [
61+
'users' => [
62+
'driver' => 'eloquent',
63+
'model' => App\User::class,
64+
],
65+
// 'users' => [
66+
// 'driver' => 'database',
67+
// 'table' => 'users',
68+
// ],
69+
],
70+
/*
71+
|--------------------------------------------------------------------------
72+
| Resetting Passwords
73+
|--------------------------------------------------------------------------
74+
|
75+
| Here you may set the options for resetting passwords including the view
76+
| that is your password reset e-mail. You may also set the name of the
77+
| table that maintains all of the reset tokens for your application.
78+
|
79+
| You may specify multiple password reset configurations if you have more
80+
| than one user table or model in the application and you want to have
81+
| separate password reset settings based on the specific user types.
82+
|
83+
| The expire time is the number of minutes that the reset token should be
84+
| considered valid. This security feature keeps tokens short-lived so
85+
| they have less time to be guessed. You may change this as needed.
86+
|
87+
*/
88+
'passwords' => [
89+
'users' => [
90+
'provider' => 'users',
91+
'email' => 'auth.emails.password',
92+
'table' => 'password_resets',
93+
'expire' => 60,
94+
],
95+
],
96+
];
File renamed without changes.

‎tests/functional/CustomValidationCest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class CustomValidationCest
44
{
55
public function _before(FunctionalTester $I)
66
{
7+
$I->amOnPage('');
78
$I->haveRecord('posts', [
89
'title' => 'Hello Universe',
910
'body' => 'You are so awesome',
@@ -20,7 +21,7 @@ public function testCustomValidationSuccess(FunctionalTester $I)
2021

2122
public function testCustomValidationError(FunctionalTester $I)
2223
{
23-
$I->amOnPage('validation?postal_code=&post_id=123456');
24+
$I->amOnPage('validation?postal_code=invalid&post_id=123456');
2425
$I->seeFormErrorMessage('postal_code');
2526
$I->seeFormErrorMessage('post_id');
2627
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /