Skip to content

Commit 38f795e

Browse files
committed
Add Laravel 5.6 compatibility
1 parent 7ee2336 commit 38f795e

File tree

8 files changed

+103
-23
lines changed

8 files changed

+103
-23
lines changed

.travis.yml

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

33
php:
4-
- 7.0
5-
- 7.1
4+
- 7.1.3
65
- 7.2
76

87
before_script:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
Blade template use.
1818

1919
## Requirements and Compatibility
20-
- PHP 7
21-
- Laravel 5.5
20+
- PHP >= 7.1.3
21+
- Laravel >= 5.5
2222

2323
### Legacy Versions
2424
- [Laravel 5.2](https://github.com/GeneaLabs/laravel-mixpanel/tree/afcf3737412c1aebfa9dd1d7687001f78bdb3956)

composer.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,28 @@
1414
}
1515
},
1616
"require": {
17-
"php": ">=7.0.0",
18-
"illuminate/auth": "5.5.*",
19-
"illuminate/config": "5.5.*",
20-
"illuminate/console": "5.5.*",
21-
"illuminate/events": "5.5.*",
22-
"illuminate/http": "5.5.*",
23-
"illuminate/routing": "5.5.*",
24-
"illuminate/queue": "5.5.*",
25-
"illuminate/support": "5.5.*",
26-
"nesbot/carbon": "^1.19",
17+
"php": ">=7.1.3",
18+
"illuminate/auth": "5.5 - 5.6",
19+
"illuminate/config": "5.5 - 5.6",
20+
"illuminate/console": "5.5 - 5.6",
21+
"illuminate/events": "5.5 - 5.6",
22+
"illuminate/http": "5.5 - 5.6",
23+
"illuminate/routing": "5.5 - 5.6",
24+
"illuminate/queue": "5.5 - 5.6",
25+
"illuminate/support": "5.5 - 5.6",
2726
"mixpanel/mixpanel-php": "~2.0",
2827
"sinergi/browser-detector": "~5.0"
2928
},
3029
"require-dev": {
3130
"fzaninotto/faker": "~1.4",
32-
"laravel/laravel": "5.5.*",
33-
"laravel/browser-kit-testing": "^2.0",
31+
"laravel/laravel": "5.6",
32+
"laravel/browser-kit-testing": "^4.0",
3433
"mockery/mockery": "0.9.*",
3534
"phpmd/phpmd": "^2.6",
36-
"phpunit/phpunit": "5.7.*",
35+
"phpunit/phpunit": "*",
3736
"sebastian/phpcpd": "*",
3837
"symfony/thanks": "^1.0",
39-
"codedungeon/phpunit-result-printer": "^0.5.0",
38+
"codedungeon/phpunit-result-printer": "*",
4039
"php-coveralls/php-coveralls": "^2.0"
4140
},
4241
"autoload-dev": {

src/Events/MixpanelEvent.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?php namespace GeneaLabs\LaravelMixpanel\Events;
22

33
use Illuminate\Queue\SerializesModels;
4-
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
5-
use Illuminate\Support\Collection;
6-
use Carbon\Carbon;
74

85
class MixpanelEvent
96
{

src/Listeners/MixpanelEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php namespace GeneaLabs\LaravelMixpanel\Listeners;
22

3-
use Carbon\Carbon;
43
use GeneaLabs\LaravelMixpanel\Events\MixpanelEvent as Event;
4+
use Illuminate\Support\Carbon;
55

66
class MixpanelEvent
77
{
@@ -42,7 +42,7 @@ private function getProfileData($user) : array
4242
'$name' => $user->name,
4343
'$email' => $user->email,
4444
'$created' => ($user->created_at
45-
? (new Carbon)
45+
? (new Carbon())
4646
->parse($user->created_at)
4747
->format('Y-m-d\Th:i:s')
4848
: null),

tests/Fixtures/app/User.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php namespace GeneaLabs\LaravelMixpanel\Tests\Fixtures\App;
2+
3+
use Illuminate\Notifications\Notifiable;
4+
use Illuminate\Foundation\Auth\User as Authenticatable;
5+
6+
class User extends Authenticatable
7+
{
8+
use Notifiable;
9+
10+
/**
11+
* The attributes that are mass assignable.
12+
*
13+
* @var array
14+
*/
15+
protected $fillable = [
16+
'name', 'email', 'password',
17+
];
18+
19+
/**
20+
* The attributes that should be hidden for arrays.
21+
*
22+
* @var array
23+
*/
24+
protected $hidden = [
25+
'password', 'remember_token',
26+
];
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Faker\Generator as Faker;
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Model Factories
8+
|--------------------------------------------------------------------------
9+
|
10+
| This directory should contain each of the model factory definitions for
11+
| your application. Factories provide a convenient way to generate new
12+
| model instances for testing / seeding your application's database.
13+
|
14+
*/
15+
16+
$factory->define(GeneaLabs\LaravelMixpanel\Tests\Fixtures\App\User::class, function (Faker $faker) {
17+
return [
18+
'name' => $faker->name,
19+
'email' => $faker->unique()->safeEmail,
20+
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
21+
'remember_token' => str_random(10),
22+
];
23+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateUsersTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('users', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('name');
19+
$table->string('email')->unique();
20+
$table->string('password');
21+
$table->rememberToken();
22+
$table->timestamps();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
Schema::dropIfExists('users');
34+
}
35+
}

0 commit comments

Comments
 (0)