Skip to content

Commit e1bf943

Browse files
committed
Merge branch 'laravel-5.4'
2 parents 53b9a04 + 1186dfb commit e1bf943

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+312
-304
lines changed

classes/Controllers/ResetPassword.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ public function showResetForm(Request $request, $token = null)
3636
'password_confirmation' => 'required|same:password',
3737
]);
3838

39-
// Lookup the admin
40-
$user = Admin::where('token', $token)
41-
->join('password_resets', 'password_resets.email', '=', 'admins.email')
42-
->firstOrFail();
43-
4439
// Set the breadcrumbs
4540
app('decoy.breadcrumbs')->set([
4641
route('decoy::account@login') => 'Login',
@@ -53,7 +48,6 @@ public function showResetForm(Request $request, $token = null)
5348
$this->description = 'Almost done.';
5449

5550
return $this->populateView('decoy::account.reset', [
56-
'user' => $user,
5751
'token' => $token,
5852
]);
5953
}

classes/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function handling()
231231

232232
/**
233233
* Force Decoy to believe that it's handling or not handling the request
234-
*
234+
*
235235
* @param boolean $bool
236236
* @return void
237237
*/
@@ -254,7 +254,7 @@ public function locale($locale = null)
254254
&& ($locales = Config::get('decoy.site.locales'))
255255
&& is_array($locales)
256256
&& isset($locales[$locale])) {
257-
return Session::set('locale', $locale);
257+
return Session::put('locale', $locale);
258258
}
259259

260260
// Return the current locale or default to first one. Store it in a local var

classes/Models/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected static function boot()
117117
return false;
118118
}
119119
$image->populateFileMeta();
120-
}, config('upchuck.priority', 0) + 1);
120+
});
121121

122122
// If the image is deleted, delete Croppa crops
123123
static::updating(function (Image $image) {

classes/Observers/Changes.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ class Changes
2323
/**
2424
* Handle all Eloquent model events
2525
*
26-
* @param Bkwld\Decoy\Models\Base $model
26+
* @param string $event
27+
* @param array $payload Contains:
28+
* - Bkwld\Decoy\Models\Base $model
2729
*/
28-
public function handle($model)
30+
public function handle($event, $payload)
2931
{
32+
list($model) = $payload;
33+
3034
// Don't log the Change model events
3135
if (is_a($model, Models\Change::class)) {
3236
return;
@@ -57,7 +61,7 @@ public function handle($model)
5761
}
5862

5963
// Get the action of the event
60-
preg_match('#eloquent\.(\w+)#', Event::firing(), $matches);
64+
preg_match('#eloquent\.(\w+)#', $event, $matches);
6165
$action = $matches[1];
6266
if (!in_array($action, $this->supported)) {
6367
return;

classes/Observers/Encoding.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ class Encoding
1010
/**
1111
* Start a new encode if a new encodable file was uploaded
1212
*
13-
* @param Bkwld\Decoy\Models\Base $model
13+
* @param string $event
14+
* @param array $payload Contains:
15+
* - Bkwld\Decoy\Models\Base $model
1416
* @return void
1517
*/
16-
public function onSaving($model)
18+
public function onSaving($event, $payload)
1719
{
20+
list($model) = $payload;
21+
1822
if (!$this->isEncodable($model)) {
1923
return;
2024
}
@@ -36,10 +40,11 @@ public function onSaving($model)
3640
/**
3741
* Delete all encodes on the model
3842
*
43+
* @param string $event
3944
* @param Bkwld\Decoy\Models\Base $model
4045
* @return void
4146
*/
42-
public function onDeleted($model)
47+
public function onDeleted($event, $model)
4348
{
4449
if (!$this->isEncodable($model)) {
4550
return;

classes/Observers/Localize.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ class Localize
1515
/**
1616
* Called on model saving
1717
*
18-
* @param Bkwld\Decoy\Models\Base $model
18+
* @param string $event
19+
* @param array $payload Contains:
20+
* - Bkwld\Decoy\Models\Base $model
21+
* @return void
1922
*/
20-
public function handle($model)
23+
public function handle($event, $payload)
2124
{
25+
list($model) = $payload;
26+
2227
if (!empty($model->locale)
2328
&& empty($model->locale_group)
2429
&& !is_a($model, Element::class) // Elements don't have groups

classes/Observers/ManyToManyChecklist.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ class ManyToManyChecklist
2020
* Take input from a Many to Many Checklist and commit it to the db. Called
2121
* on model saved.
2222
*
23-
* @param Bkwld\Decoy\Models\Base $model
23+
* @param string $event
24+
* @param array $payload Contains:
25+
* - Bkwld\Decoy\Models\Base $model
26+
* @return void
2427
*/
25-
public function handle($model)
28+
public function handle($event, $payload)
2629
{
30+
list($model) = $payload;
31+
2732
// Check for matching input elements
2833
foreach (Request::input() as $key => $val) {
2934
if (preg_match('#^'.self::PREFIX.'(.+)#', $key, $matches)) {

classes/Observers/ModelCallbacks.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class ModelCallbacks
1414
/**
1515
* Handle all model events, both Eloquent and Decoy
1616
*
17-
* @param Bkwld\Decoy\Models\Base $model
17+
* @param string $event
18+
* @param array $payload Contains:
19+
* - Bkwld\Decoy\Models\Base $model
20+
* @return void
1821
*/
19-
public function handle($model)
22+
public function handle($event, $payload)
2023
{
21-
// Get the name of the event. Examples:
22-
// - eloquent.saving: Person
23-
// - decoy::model.validating: Person
24-
$event = Event::firing();
24+
list($model) = $payload;
2525

2626
// Get the action from the event name
2727
preg_match('#\.(\w+)#', $event, $matches);
@@ -31,7 +31,7 @@ public function handle($model)
3131
// any additional event arguments to it
3232
$method = 'on'.Str::studly($action);
3333
if (method_exists($model, $method)) {
34-
return call_user_func_array([$model, $method], array_slice(func_get_args(), 1));
34+
return call_user_func_array([$model, $method], array_slice($payload, 1));
3535
}
3636
}
3737
}

classes/Observers/ValidateExistingFiles.php

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

33
namespace Bkwld\Decoy\Observers;
44

5-
use Config;
5+
// Deps
66
use Symfony\Component\HttpFoundation\File\File;
77

88
/**
@@ -15,14 +15,19 @@ class ValidateExistingFiles
1515
/**
1616
* Massage validation handling
1717
*
18-
* @param Bkwld\Decoy\Models\Base $model
19-
* @param Illuminate\Validation\Validator $validation
18+
* @param string $event
19+
* @param array $payload Contains:
20+
* - Bkwld\Decoy\Models\Base
21+
* - Illuminate\Validation\Validator
2022
* @return void
2123
*/
22-
public function onValidating($model, $validation)
24+
public function onValidating($event, $payload)
2325
{
26+
// Destructure payload
27+
list($model, $validation) = $payload;
28+
2429
// Only act on locally hosted files
25-
if (Config::get('upchuck.disk.driver') != 'local') {
30+
if (config('upchuck.disk.driver') != 'local') {
2631
return;
2732
}
2833

@@ -78,7 +83,7 @@ public function onValidating($model, $validation)
7883
public function makeFileFromPath($path)
7984
{
8085
$upchuck_path = app('upchuck')->path($path);
81-
$absolute_path = Config::get('upchuck.disk.path').'/'.$upchuck_path;
86+
$absolute_path = config('upchuck.disk.path').'/'.$upchuck_path;
8287
return new File($absolute_path);
8388

8489
}

classes/ServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,15 @@ protected function delegateAdminObservers()
200200
*/
201201
protected function registerMiddlewares()
202202
{
203+
203204
// Register middleware individually
204205
foreach ([
205206
'decoy.auth' => Middleware\Auth::class,
206207
'decoy.edit-redirect' => Middleware\EditRedirect::class,
207208
'decoy.guest' => Middleware\Guest::class,
208209
'decoy.save-redirect' => Middleware\SaveRedirect::class,
209210
] as $key => $class) {
210-
$this->app['router']->middleware($key, $class);
211+
$this->app['router']->aliasMiddleware($key, $class);
211212
}
212213

213214
// This group is used by public decoy routes

0 commit comments

Comments
 (0)