Skip to content

Commit

Permalink
Adding Laravel 5.2 & 5.3 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Feb 1, 2017
1 parent ed06ac5 commit efc800a
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 98 deletions.
17 changes: 10 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
* text=auto

/.github export-ignore
/_docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpunit.xml export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml export-ignore
CONTRIBUTING.md export-ignore
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Settings Version: #.#.#
- Laravel Version: #.#.#
- PHP Version: #.#.#

### Description:

### Steps To Reproduce:
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ language: php
sudo: false

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- hhvm
- 7.1
- nightly

matrix:
allow_failures:
- php: nightly

env:
- TESTBENCH_VERSION=3.1.*
- TESTBENCH_VERSION=3.2.*
- TESTBENCH_VERSION=3.3.*

before_script:
- travis_retry composer self-update
Expand All @@ -22,5 +27,5 @@ script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2016 | ARCANEDEV <[email protected]> - Settings
Copyright (c) 2015-2017 | ARCANEDEV <[email protected]> - Settings

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Settings [![Packagist License][badge_license]](LICENSE.md) [![For Laravel 5.1][badge_laravel]](https://github.com/ARCANESOFT/Settings#settings)

[![Travis Status][badge_build]](https://travis-ci.org/ARCANESOFT/Settings)
[![HHVM Status][badge_hhvm]](http://hhvm.h4cc.de/package/arcanesoft/settings)
[![Coverage Status][badge_coverage]](https://scrutinizer-ci.com/g/ARCANESOFT/Settings/?branch=master)
[![Scrutinizer Code Quality][badge_quality]](https://scrutinizer-ci.com/g/ARCANESOFT/Settings/?branch=master)
[![SensioLabs Insight][badge_insight]](https://insight.sensiolabs.com/projects/6f7245df-02d1-4a72-b6c9-a6b87d875275)
Expand All @@ -11,20 +10,6 @@
[![Packagist Release][badge_release]](https://packagist.org/packages/arcanesoft/settings)
[![Packagist Downloads][badge_downloads]](https://packagist.org/packages/arcanesoft/settings)

[badge_license]: http://img.shields.io/packagist/l/arcanesoft/settings.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For-ARCANESOFT%20CMS-orange.svg?style=flat-square

[badge_build]: http://img.shields.io/travis/ARCANESOFT/Settings.svg?style=flat-square
[badge_hhvm]: https://img.shields.io/hhvm/arcanesoft/settings.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/6f7245df-02d1-4a72-b6c9-a6b87d875275.svg?style=flat-square
[badge_issues]: http://img.shields.io/github/issues/ARCANESOFT/Settings.svg?style=flat-square

[badge_package]: https://img.shields.io/badge/package-arcanesoft/settings-blue.svg?style=flat-square
[badge_release]: https://img.shields.io/packagist/v/arcanesoft/settings.svg?style=flat-square
[badge_downloads]: https://img.shields.io/packagist/dt/arcanesoft/settings.svg?style=flat-square

*By [ARCANEDEV&copy;](http://www.arcanedev.net/)*

This package allow to have a persistent settings.
Expand Down Expand Up @@ -56,3 +41,16 @@ Feel free to check out the [releases](https://github.com/ARCANESOFT/Settings/rel
## Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests, please check the [contribution guidelines](CONTRIBUTING.md).

[badge_license]: http://img.shields.io/packagist/l/arcanesoft/settings.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For-ARCANESOFT%20CMS-orange.svg?style=flat-square

[badge_build]: http://img.shields.io/travis/ARCANESOFT/Settings.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/6f7245df-02d1-4a72-b6c9-a6b87d875275.svg?style=flat-square
[badge_issues]: http://img.shields.io/github/issues/ARCANESOFT/Settings.svg?style=flat-square

[badge_package]: https://img.shields.io/badge/package-arcanesoft/settings-blue.svg?style=flat-square
[badge_release]: https://img.shields.io/packagist/v/arcanesoft/settings.svg?style=flat-square
[badge_downloads]: https://img.shields.io/packagist/dt/arcanesoft/settings.svg?style=flat-square
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"type": "library",
"license": "MIT",
"require": {
"php" : ">=5.5.9",
"php" : ">=5.6.4",
"arcanedev/support": "~3.0"
},
"require-dev": {
"phpunit/phpcov": "~2.0|~3.0",
"phpunit/phpunit": "~4.0|~5.0"
"phpunit/phpcov": "~3.0",
"phpunit/phpunit": "~5.0"
},
"autoload": {
"psr-4": {
Expand All @@ -33,7 +33,7 @@
}
},
"scripts": {
"testbench": "composer require --dev \"orchestra/testbench=~3.1.0\""
"testbench": "composer require --dev \"orchestra/testbench=~3.1\""
},
"extra": {
"branch-alias": {
Expand Down
42 changes: 6 additions & 36 deletions src/Providers/CommandServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,15 @@
class CommandServiceProvider extends ServiceProvider
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
| Properties
| ------------------------------------------------------------------------------------------------
*/
/**
* Register the service provider.
*/
public function register()
{
$this->registerPublishCommand();

$this->commands($this->commands);
}

/**
* Get the provided commands.
* The commands to be registered.
*
* @return array
* @var array
*/
public function provides()
{
return [
'arcanesoft.settings.commands.publish',
];
}

/* ------------------------------------------------------------------------------------------------
| Command Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Register the publish command.
*/
private function registerPublishCommand()
{
$this->app->singleton(
'arcanesoft.settings.commands.publish',
\Arcanesoft\Settings\Console\PublishCommand::class
);

$this->commands[] = \Arcanesoft\Settings\Console\PublishCommand::class;
}
protected $commands = [
\Arcanesoft\Settings\Console\PublishCommand::class,
];
}
2 changes: 1 addition & 1 deletion src/SettingsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function getChanges($saved)
})->toArray(),
$saved->groupBy('domain')->map(function($item) {
/** @var \Illuminate\Database\Eloquent\Collection $item */
return $item->lists('casted_value', 'key');
return $item->pluck('casted_value', 'key');
})->toArray()
);
}
Expand Down
38 changes: 10 additions & 28 deletions src/SettingsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Arcanesoft\Settings;

use Arcanedev\Support\PackageServiceProvider;
use Illuminate\Support\Str;

/**
* Class SettingsServiceProvider
Expand Down Expand Up @@ -49,7 +50,7 @@ public function getBasePath()
*/
protected function getConfigKey()
{
return str_slug($this->vendor . ' ' . $this->package, '.');
return Str::slug($this->vendor.' '.$this->package, '.');
}

/* ------------------------------------------------------------------------------------------------
Expand All @@ -76,7 +77,12 @@ public function boot()
{
parent::boot();

$this->registerPublishes();
// Config
$this->publishes([
$this->getConfigFile() => config_path("{$this->vendor}/{$this->package}.php"),
], 'config');

$this->publishMigrations();
}

/**
Expand All @@ -86,7 +92,7 @@ public function provides()
{
return [
'arcanesoft.settings.manager',
\Arcanesoft\Settings\Contracts\Settings::class,
Contracts\Settings::class,
];
}

Expand All @@ -99,30 +105,6 @@ public function provides()
*/
private function registerSettingsManager()
{
$this->singleton(
'arcanesoft.settings.manager',
\Arcanesoft\Settings\SettingsManager::class
);

$this->bind(
\Arcanesoft\Settings\Contracts\Settings::class,
'arcanesoft.settings.manager'
);
}

/**
* Register publishes.
*/
private function registerPublishes()
{
// Config
$this->publishes([
$this->getConfigFile() => config_path("{$this->vendor}/{$this->package}.php"),
], 'config');

// Migrations
$this->publishes([
$this->getBasePath() . '/database/migrations/' => database_path('migrations')
], 'migrations');
$this->singleton(Contracts\Settings::class, SettingsManager::class);
}
}
2 changes: 1 addition & 1 deletion tests/Providers/CommandServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function it_can_be_instantiated()
public function it_can_provides()
{
$expected = [
'arcanesoft.settings.commands.publish',
\Arcanesoft\Settings\Console\PublishCommand::class,
];

$this->assertEquals($expected, $this->provider->provides());
Expand Down

0 comments on commit efc800a

Please sign in to comment.