Skip to content

Commit

Permalink
Add Laravel 5.6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Feb 10, 2018
1 parent 7ee2336 commit 38f795e
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,8 +1,7 @@
language: php

php:
- 7.0
- 7.1
- 7.1.3
- 7.2

before_script:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -17,8 +17,8 @@
Blade template use.

## Requirements and Compatibility
- PHP 7
- Laravel 5.5
- PHP >= 7.1.3
- Laravel >= 5.5

### Legacy Versions
- [Laravel 5.2](https://github.com/GeneaLabs/laravel-mixpanel/tree/afcf3737412c1aebfa9dd1d7687001f78bdb3956)
Expand Down
27 changes: 13 additions & 14 deletions composer.json
Expand Up @@ -14,29 +14,28 @@
}
},
"require": {
"php": ">=7.0.0",
"illuminate/auth": "5.5.*",
"illuminate/config": "5.5.*",
"illuminate/console": "5.5.*",
"illuminate/events": "5.5.*",
"illuminate/http": "5.5.*",
"illuminate/routing": "5.5.*",
"illuminate/queue": "5.5.*",
"illuminate/support": "5.5.*",
"nesbot/carbon": "^1.19",
"php": ">=7.1.3",
"illuminate/auth": "5.5 - 5.6",
"illuminate/config": "5.5 - 5.6",
"illuminate/console": "5.5 - 5.6",
"illuminate/events": "5.5 - 5.6",
"illuminate/http": "5.5 - 5.6",
"illuminate/routing": "5.5 - 5.6",
"illuminate/queue": "5.5 - 5.6",
"illuminate/support": "5.5 - 5.6",
"mixpanel/mixpanel-php": "~2.0",
"sinergi/browser-detector": "~5.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"laravel/laravel": "5.5.*",
"laravel/browser-kit-testing": "^2.0",
"laravel/laravel": "5.6",
"laravel/browser-kit-testing": "^4.0",
"mockery/mockery": "0.9.*",
"phpmd/phpmd": "^2.6",
"phpunit/phpunit": "5.7.*",
"phpunit/phpunit": "*",
"sebastian/phpcpd": "*",
"symfony/thanks": "^1.0",
"codedungeon/phpunit-result-printer": "^0.5.0",
"codedungeon/phpunit-result-printer": "*",
"php-coveralls/php-coveralls": "^2.0"
},
"autoload-dev": {
Expand Down
3 changes: 0 additions & 3 deletions src/Events/MixpanelEvent.php
@@ -1,9 +1,6 @@
<?php namespace GeneaLabs\LaravelMixpanel\Events;

use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Support\Collection;
use Carbon\Carbon;

class MixpanelEvent
{
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/MixpanelEvent.php
@@ -1,7 +1,7 @@
<?php namespace GeneaLabs\LaravelMixpanel\Listeners;

use Carbon\Carbon;
use GeneaLabs\LaravelMixpanel\Events\MixpanelEvent as Event;
use Illuminate\Support\Carbon;

class MixpanelEvent
{
Expand Down Expand Up @@ -42,7 +42,7 @@ private function getProfileData($user) : array
'$name' => $user->name,
'$email' => $user->email,
'$created' => ($user->created_at
? (new Carbon)
? (new Carbon())
->parse($user->created_at)
->format('Y-m-d\Th:i:s')
: null),
Expand Down
27 changes: 27 additions & 0 deletions tests/Fixtures/app/User.php
@@ -0,0 +1,27 @@
<?php namespace GeneaLabs\LaravelMixpanel\Tests\Fixtures\App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
use Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];

/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
23 changes: 23 additions & 0 deletions tests/database/factories/UserFactory.php
@@ -0,0 +1,23 @@
<?php

use Faker\Generator as Faker;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(GeneaLabs\LaravelMixpanel\Tests\Fixtures\App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
35 changes: 35 additions & 0 deletions tests/database/migrations/2014_10_12_000000_create_users_table.php
@@ -0,0 +1,35 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

0 comments on commit 38f795e

Please sign in to comment.