Skip to content

Commit 4901199

Browse files
mazimroshangautam
authored andcommitted
[feature] laravel 6.0 compatibility
- refactor to support Laravel 6.0
1 parent 7809f9d commit 4901199

File tree

12 files changed

+31
-25
lines changed

12 files changed

+31
-25
lines changed

.travis.yml

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

33
php:
4-
- 7.1
4+
- 7.2
55

66
sudo: false
77

@@ -14,4 +14,4 @@ before_install:
1414

1515
install: travis_retry composer install --no-interaction --prefer-dist --no-suggest
1616

17-
script: vendor/bin/phpunit --verbose
17+
script: vendor/bin/phpunit --verbose

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.1",
19+
"php": ">=7.2",
2020
"doctrine/dbal": "^2.9",
21-
"illuminate/bus": "~5.8.0",
22-
"illuminate/console": "~5.8.0",
23-
"illuminate/contracts": "~5.8.0",
24-
"illuminate/database": "~5.8.0",
25-
"illuminate/events": "~5.8.0",
26-
"illuminate/notifications": "~5.8.0",
27-
"laravelcollective/html": "^5.8"
21+
"illuminate/bus": "~6.0.0",
22+
"illuminate/console": "~6.0.0",
23+
"illuminate/contracts": "~6.0.0",
24+
"illuminate/database": "~6.0.0",
25+
"illuminate/events": "~6.0.0",
26+
"illuminate/notifications": "~6.0.0",
27+
"laravelcollective/html": "^6.0"
2828
},
2929
"require-dev": {
3030
"mockery/mockery": "^1.0",
31-
"orchestra/database": "^3.7",
32-
"orchestra/testbench" : "^3.8",
33-
"phpunit/phpunit": "^7.5"
31+
"orchestra/database": "^4.0",
32+
"orchestra/testbench" : "^4.0",
33+
"phpunit/phpunit": "^8.3"
3434
},
3535
"suggest": {
3636
"nexmo/client": "Required for sms notifications."

database/factories/ModelFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'name' => $faker->name,
2020
'email' => $faker->unique()->safeEmail,
2121
'password' => $password ?: $password = bcrypt('secret'),
22-
'remember_token' => str_random(10),
22+
'remember_token' => \Illuminate\Support\Str::random(10),
2323
];
2424
});
2525

resources/views/partials/sidebar.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
</div>
66
<hr>
77
<ul class="uk-nav uk-nav-default">
8-
<li class="{{ str_contains(url()->current(), 'tasks') ? 'uk-active' : '' }}">
8+
<li class="{{ Str::contains(url()->current(), 'tasks') ? 'uk-active' : '' }}">
99
<a href="{{route('totem.tasks.all')}}" class="uk-flex uk-flex-middle">
1010
<span uk-icon="icon: clock; ratio: 1" class="uk-visible@m uk-margin-small-right"></span>
1111
<span class="uk-vertical-align-middle">Tasks</span>
1212
</a>
1313
</li>
1414
</ul>
1515
<hr>
16-
</aside>
16+
</aside>

resources/views/tasks/view.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ul class="uk-list uk-list-striped">
1414
<li>
1515
<span class="uk-text-muted uk-float-right">Description</span>
16-
<span class="uk-float-left">{{str_limit($task->description, 80)}}</span>
16+
<span class="uk-float-left">{{Str::limit($task->description, 80)}}</span>
1717
</li>
1818
<li>
1919
<span class="uk-text-muted uk-float-right">Command</span>
@@ -128,4 +128,4 @@
128128
{{$results->links('totem::partials.pagination')}}
129129
</div>
130130
</div>
131-
@stop
131+
@stop

src/Console/Commands/ListSchedule.php

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

55
use Carbon\Carbon;
66
use Cron\CronExpression;
7+
use Illuminate\Support\Str;
78
use Illuminate\Console\Command;
89
use Illuminate\Console\Scheduling\Schedule;
910

@@ -52,7 +53,7 @@ public function handle()
5253
$events = collect($this->schedule->events())->map(function ($event) {
5354
return [
5455
'description' => $event->description ?: 'N/A',
55-
'command' => ltrim(strtok(str_after($event->command, "'artisan'"), ' ')),
56+
'command' => ltrim(strtok(Str::after($event->command, "'artisan'"), ' ')),
5657
'schedule' => $event->expression,
5758
'upcoming' => $this->upcoming($event),
5859
'timezone' => $event->timezone ?: config('app.timezone'),

src/Http/Requests/TaskRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function messages()
5959
*
6060
* @return array
6161
*/
62-
protected function validationData()
62+
public function validationData()
6363
{
6464
if ($this->input('type') == 'frequency') {
6565
$this->merge(['expression' => null]);

src/Repositories/EloquentTaskRepository.php

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

55
use Studio\Totem\Task;
66
use Studio\Totem\Result;
7+
use Illuminate\Support\Arr;
78
use Studio\Totem\Events\Created;
89
use Studio\Totem\Events\Deleted;
910
use Studio\Totem\Events\Updated;
@@ -97,7 +98,7 @@ public function store(array $input)
9798
return false;
9899
}
99100

100-
$task->fill(array_only($input, $task->getFillable()))->save();
101+
$task->fill(Arr::only($input, $task->getFillable()))->save();
101102

102103
Created::dispatch($task);
103104

@@ -119,7 +120,7 @@ public function update(array $input, $task)
119120
return false;
120121
}
121122

122-
$task->fill(array_only($input, $task->getFillable()))->save();
123+
$task->fill(Arr::only($input, $task->getFillable()))->save();
123124

124125
Updated::dispatch($task);
125126

src/Task.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Carbon\Carbon;
66
use Cron\CronExpression;
7+
use Illuminate\Support\Str;
78
use Studio\Totem\Traits\HasFrequencies;
89
use Illuminate\Notifications\Notifiable;
910
use Studio\Totem\Traits\FrontendSortable;

src/TotemModel.php

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

33
namespace Studio\Totem;
44

5+
use Illuminate\Support\Str;
56
use Illuminate\Database\Eloquent\Model;
67

78
class TotemModel extends Model
@@ -13,7 +14,7 @@ class TotemModel extends Model
1314
*/
1415
public function getTable()
1516
{
16-
if (str_contains(parent::getTable(), TOTEM_TABLE_PREFIX)) {
17+
if (Str::contains(parent::getTable(), TOTEM_TABLE_PREFIX)) {
1718
return parent::getTable();
1819
}
1920

0 commit comments

Comments
 (0)