Skip to content

Commit 7a4acfa

Browse files
committed
Merge branch '5.11.x'
2 parents c6b963d + 7b163a2 commit 7a4acfa

File tree

23 files changed

+162
-83
lines changed

23 files changed

+162
-83
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22

33
php:
4-
- 7.0.15
54
- 7.1
5+
- 7.2
66

77
install:
88
- composer install

classes/Models/Change.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function shouldLogChange($action)
9696
public static function log(Model $model, $action, Admin $admin = null)
9797
{
9898
// Create a new change instance
99-
if (static::shouldWriteChange($model)) {
99+
if (static::shouldWriteChange($model, $action)) {
100100
$changed = static::getChanged($model, $action);
101101
$change = static::createLog($model, $action, $admin, $changed);
102102
}
@@ -125,10 +125,12 @@ public static function log(Model $model, $action, Admin $admin = null)
125125
* besides these that changed.
126126
*
127127
* @param Model $model The model being touched
128+
* @param string $action
128129
* @return boolean
129130
*/
130-
static private function shouldWriteChange(Model $model)
131+
static private function shouldWriteChange(Model $model, $action)
131132
{
133+
if (in_array($action, ['created', 'deleted'])) return true;
132134
$changed_attributes = array_keys($model->getDirty());
133135
$ignored = ['updated_at', 'public'];
134136
$loggable = array_diff($changed_attributes, $ignored);

classes/Models/Command.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public static function all()
3535
$commands['Laravel']['Seed'] = App::make('command.seed');
3636
$commands['Laravel']['Cache clear'] = App::make('command.cache.clear');
3737
$commands['Laravel']['Clear compiled classes'] = App::make('command.clear-compiled');
38-
$commands['Laravel']['Optimize classes'] = App::make('command.optimize');
3938

4039
// Return matching commands
4140
return $commands;

classes/Models/Traits/Loggable.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Bkwld\Decoy\Models\Image;
1010
use Decoy;
1111
use Illuminate\Database\Eloquent\Builder;
12+
use Illuminate\Database\Eloquent\SoftDeletingScope;
1213

1314
/**
1415
* Enable logging changes to models
@@ -48,7 +49,8 @@ public function changes()
4849
*/
4950
public static function bootLoggable()
5051
{
51-
// Automatically eager load the images relationship
52+
// Add scope that will fetch trashed versions of models when the
53+
// Change::QUERY_KEY is present.
5254
static::addGlobalScope(static::$LOGGABLE_SCOPE, function (Builder $builder) {
5355
static::showTrashedVersion($builder);
5456
});
@@ -83,7 +85,7 @@ private static function showTrashedVersion(Builder $builder)
8385
{
8486
if (($change = static::lookupRequestedChange())
8587
&& static::builderMatchesChange($change, $builder)) {
86-
static::includeTrashed($change, $builder);
88+
$builder->withoutGlobalScope(SoftDeletingScope::class);
8789
}
8890
}
8991

@@ -149,28 +151,6 @@ private static function builderMatchesChange(Change $change, Builder $builder)
149151
});
150152
}
151153

152-
/**
153-
* Manually remove already added soft deleted where conditions. This is
154-
* necessary since withTrashed() can't be called on a Builder.
155-
* http://yo.bkwld.com/1K04151B2h3M
156-
*
157-
* @param Change $change
158-
* @param Builder $builder
159-
* @return void
160-
*/
161-
private static function includeTrashed(Change $change, Builder $builder)
162-
{
163-
$class = $change->model;
164-
$table = (new $class)->getTable();
165-
foreach($builder->getQuery()->wheres as $key => $where) {
166-
if ($where['column'] == $table.'.deleted_at'
167-
&& $where['type'] == 'Null') {
168-
unset($builder->getQuery()->wheres[$key]);
169-
break;
170-
}
171-
}
172-
}
173-
174154
/**
175155
* Replace all the attributes with those from the specified Change specified
176156
* in the reqeust query.

classes/Observers/ValidateExistingFiles.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// Deps
66
use Symfony\Component\HttpFoundation\File\File;
7+
use Symfony\Component\HttpFoundation\File\UploadedFile;
78

89
/**
910
* When a form is updated (as opposed to created) the previous files are
@@ -77,16 +78,19 @@ public function onValidating($event, $payload)
7778
}
7879

7980
/**
80-
* Make a file instance using uphuck from the string input value
81+
* Make an UploadedFile instance using Upchuck from the string input value
8182
*
8283
* @param string $path
83-
* @return File
84+
* @return UploadedFile
8485
*/
8586
public function makeFileFromPath($path)
8687
{
8788
$upchuck_path = app('upchuck')->path($path);
8889
$absolute_path = config('upchuck.disk.path').'/'.$upchuck_path;
89-
return new File($absolute_path);
90+
return new UploadedFile(
91+
$absolute_path, basename($absolute_path),
92+
null, null, // Default mime and error
93+
true); // Enable test mode so local file will be pass as uploaded
9094
}
9195

9296
}

classes/ServiceProvider.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Foundation\AliasLoader;
1010
use Illuminate\Contracts\Auth\Access\Gate;
1111
use Illuminate\Contracts\Debug\ExceptionHandler;
12+
use Illuminate\Pagination\Paginator;
1213
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
1314

1415
class ServiceProvider extends BaseServiceProvider
@@ -121,6 +122,11 @@ public function usingAdmin()
121122

122123
// Delegate events to Decoy observers
123124
$this->delegateAdminObservers();
125+
126+
// Use Boostrap 3 classes in Laravel 5.6
127+
if (method_exists(Paginator::class, 'useBootstrapThree')) {
128+
Paginator::useBootstrapThree();
129+
}
124130
}
125131

126132
/**

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@
3636
"cviebrock/eloquent-sluggable": "~4.0",
3737
"illuminate/support": "^5.0",
3838
"illuminate/console": "^5.0",
39-
"symfony/yaml": "~2.5 || ^3.0",
39+
"symfony/yaml": "~2.5 || ^3.0 || ^4.0",
4040
"zencoder/zencoder-php": "~2.2",
4141
"jenssegers/agent": "~2.1",
4242
"league/csv": "^9.1",
4343
"doctrine/dbal": "^2.5"
4444
},
4545
"require-dev": {
46-
"laravel/framework": "5.4.*|5.5.*",
46+
"laravel/framework": "5.4.* || 5.5.* || 5.6.*",
4747
"filp/whoops": "~2.0",
4848
"fzaninotto/faker": "~1.4",
4949
"mockery/mockery": "0.9.*",
50-
"phpunit/phpunit": "~6.0",
51-
"symfony/css-selector": "3.1.*",
52-
"symfony/dom-crawler": "3.1.*",
53-
"satooshi/php-coveralls": "^1.0",
50+
"phpunit/phpunit": "~6.0 || ~7.0",
51+
"symfony/css-selector": "3.1.* || ^4.0",
52+
"symfony/dom-crawler": "3.1.* || ^4.0",
53+
"php-coveralls/php-coveralls": "^1.0 || ^2.0",
5454
"adlawson/vfs": "^0.12.1",
5555
"league/flysystem": "^1.0",
5656
"league/flysystem-vfs": "^1.0",
5757
"laravel/tinker": "^1.0",
58-
"fideloper/proxy": "~3.3"
58+
"fideloper/proxy": "~3.3 || ^4.0"
5959
},
6060
"conflict": {
6161
"anahkiasen/html-object": "1.4.1",

example/.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ APP_NAME=Laravel
22
APP_ENV=local
33
APP_KEY=
44
APP_DEBUG=true
5-
APP_LOG_LEVEL=debug
65
APP_URL=http://localhost
76

7+
LOG_CHANNEL=stack
8+
89
DB_CONNECTION=mysql
910
DB_HOST=127.0.0.1
1011
DB_PORT=3306
@@ -15,6 +16,7 @@ DB_PASSWORD=secret
1516
BROADCAST_DRIVER=log
1617
CACHE_DRIVER=file
1718
SESSION_DRIVER=file
19+
SESSION_LIFETIME=120
1820
QUEUE_DRIVER=sync
1921

2022
REDIS_HOST=127.0.0.1
@@ -31,3 +33,7 @@ MAIL_ENCRYPTION=null
3133
PUSHER_APP_ID=
3234
PUSHER_APP_KEY=
3335
PUSHER_APP_SECRET=
36+
PUSHER_APP_CLUSTER=mt1
37+
38+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
39+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

example/app/Http/Controllers/Auth/RegisterController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\User;
66
use App\Http\Controllers\Controller;
7+
use Illuminate\Support\Facades\Hash;
78
use Illuminate\Support\Facades\Validator;
89
use Illuminate\Foundation\Auth\RegistersUsers;
910

@@ -50,7 +51,7 @@ protected function validator(array $data)
5051
return Validator::make($data, [
5152
'name' => 'required|string|max:255',
5253
'email' => 'required|string|email|max:255|unique:users',
53-
'password' => 'required|string|min:6|confirmed',
54+
'password' => Hash::make($data['password']),
5455
]);
5556
}
5657

example/app/Http/Kernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ class Kernel extends HttpKernel
5454
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
5555
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
5656
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
57+
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
5758
'can' => \Illuminate\Auth\Middleware\Authorize::class,
5859
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
60+
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
5961
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
6062
];
6163
}

0 commit comments

Comments
 (0)