Skip to content

Commit

Permalink
Updating the package for Laravel 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Feb 2, 2017
1 parent 5707880 commit 77d85c3
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 41 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/build/
/node_modules/
/vendor/
/composer.lock
/composer.phar
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 3
php_code_sniffer:
enabled: true
config:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"require": {
"php": ">=5.6.4",
"arcanedev/log-viewer": "~4.3",
"arcanedev/route-viewer": "~0.1",
"arcanesoft/auth": "~1.12",
"arcanesoft/core": "~1.4"
"arcanedev/route-viewer": "~1.0",
"arcanesoft/auth": "~2.0",
"arcanesoft/core": "~1.5"
},
"require-dev": {
"phpunit/phpcov": "~3.0",
Expand Down
4 changes: 2 additions & 2 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
/**
* Get the Foundation instance.
*
* @return \Arcanesoft\Foundation\Foundation
* @return \Arcanesoft\Foundation\Contracts\Foundation
*/
function foundation() {
return app('arcanesoft.foundation');
return app(Arcanesoft\Foundation\Contracts\Foundation::class);
}
}
2 changes: 1 addition & 1 deletion resources/views/admin/system/routes/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@endif
</td>
<td>
<small><b>N: </b> {{ $route->name }}</small>
<small><b>N: </b> <span class="label label-{{ $route->hasName() ? 'primary' : 'default' }}">{{ $route->name }}</span></small>
<br>
<small>
<b>A: </b> {!! preg_replace('#(@.*)$#', '<span class="text-success">$1</span>', $route->action) !!}
Expand Down
17 changes: 17 additions & 0 deletions src/Contracts/Foundation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php namespace Arcanesoft\Foundation\Contracts;

/**
* Interface Foundation
*
* @package Arcanesoft\Foundation\Contracts
* @author ARCANEDEV <[email protected]>
*/
interface Foundation
{
/**
* Get the package version.
*
* @return string
*/
public function version();
}
32 changes: 30 additions & 2 deletions src/Foundation.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
<?php namespace Arcanesoft\Foundation;

use Arcanesoft\Foundation\Contracts\Foundation as FoundationContract;
use Illuminate\Contracts\Foundation\Application;

/**
* Class Foundation
*
* @package Arcanesoft\Foundation
* @author ARCANEDEV <[email protected]>
*/
class Foundation
class Foundation implements FoundationContract
{
/* ------------------------------------------------------------------------------------------------
| Constants
| ------------------------------------------------------------------------------------------------
*/
const VERSION = '1.2.0';
const VERSION = '1.5.1';

/* ------------------------------------------------------------------------------------------------
| Properties
| ------------------------------------------------------------------------------------------------
*/
/**
* The application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
protected $app;

/* ------------------------------------------------------------------------------------------------
| Constructor
| ------------------------------------------------------------------------------------------------
*/
/**
* Foundation constructor.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct(Application $app)
{
$this->app = $app;
}

/* ------------------------------------------------------------------------------------------------
| Getters & Setters
Expand Down
6 changes: 4 additions & 2 deletions src/FoundationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public function boot()
*/
public function provides()
{
return ['arcanesoft.foundation'];
return [
Contracts\Foundation::class,
];
}

/* ------------------------------------------------------------------------------------------------
Expand All @@ -93,7 +95,7 @@ public function provides()
*/
private function registerFoundationService()
{
$this->singleton('arcanesoft.foundation', Foundation::class);
$this->singleton(Contracts\Foundation::class, Foundation::class);
}

/**
Expand Down
9 changes: 3 additions & 6 deletions src/Http/Routes/Admin/DashboardRoute.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
<?php namespace Arcanesoft\Foundation\Http\Routes\Admin;

use Arcanedev\Support\Bases\RouteRegister;
use Illuminate\Contracts\Routing\Registrar;
use Arcanedev\Support\Routing\RouteRegistrar;

/**
* Class DashboardRoute
*
* @package Arcanesoft\Foundation\Http\Routes\Admin
* @author ARCANEDEV <[email protected]>
*/
class DashboardRoute extends RouteRegister
class DashboardRoute extends RouteRegistrar
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Map routes.
*
* @param \Illuminate\Contracts\Routing\Registrar $router
*/
public function map(Registrar $router)
public function map()
{
$this->get('/', 'DashboardController@index')
->name('home'); // admin::foundation.home
Expand Down
10 changes: 4 additions & 6 deletions src/Http/Routes/Admin/SettingsRoutes.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Arcanesoft\Foundation\Http\Routes\Admin;

use Arcanedev\Support\Bases\RouteRegister;
use Arcanedev\Support\Routing\RouteRegistrar;
use Illuminate\Contracts\Routing\Registrar;

/**
Expand All @@ -9,20 +9,18 @@
* @package Arcanesoft\Foundation\Http\Routes\Admin
* @author ARCANEDEV <[email protected]>
*/
class SettingsRoutes extends RouteRegister
class SettingsRoutes extends RouteRegistrar
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Map routes.
*
* @param \Illuminate\Contracts\Routing\Registrar $router
*/
public function map(Registrar $router)
public function map()
{
$this->group(['prefix' => 'settings', 'as' => 'settings.'], function () {
$this->prefix('settings')->name('settings.')->group(function () {
$this->get('/', 'SettingsController@index')
->name('index'); // admin::foundation.settings.index
});
Expand Down
27 changes: 12 additions & 15 deletions src/Http/Routes/Admin/SystemRoutes.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
<?php namespace Arcanesoft\Foundation\Http\Routes\Admin;

use Arcanedev\Support\Bases\RouteRegister;
use Illuminate\Contracts\Routing\Registrar;
use Arcanedev\Support\Routing\RouteRegistrar;

/**
* Class SystemRoutes
*
* @package Arcanesoft\Foundation\Http\Routes\Admin
* @author ARCANEDEV <[email protected]>
*/
class SystemRoutes extends RouteRegister
class SystemRoutes extends RouteRegistrar
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Map routes.
*
* @param \Illuminate\Contracts\Routing\Registrar $router
*/
public function map(Registrar $router)
public function map()
{
$this->group(['prefix' => 'system', 'as' => 'system.', 'namespace' => 'System'], function () {
$this->prefix('system')->name('system.')->namespace('System')->group(function () {
$this->registerSystemInformationRoutes();
$this->registerLogViewerRoutes();
$this->registerRouteViewerRoutes();
Expand All @@ -38,9 +35,9 @@ public function map(Registrar $router)
*/
private function registerSystemInformationRoutes()
{
$this->group(['prefix' => 'information', 'as' => 'information.'], function () {
$this->prefix('information')->name('information.')->group(function () {
$this->get('/', 'InformationController@index')
->name('index');
->name('index'); // admin::foundation.system.information.index
});
}

Expand All @@ -49,15 +46,15 @@ private function registerSystemInformationRoutes()
*/
private function registerLogViewerRoutes()
{
$this->group(['prefix' => 'log-viewer', 'as' => 'log-viewer.'], function () {
$this->prefix('log-viewer')->name('log-viewer.')->group(function () {
$this->get('/', 'LogViewerController@index')
->name('index'); // foundation::system.log-viewer.index
->name('index'); // admin::foundation.system.log-viewer.index

$this->group(['prefix' => 'logs', 'as' => 'logs.'], function() {
$this->prefix('logs')->name('logs.')->group(function() {
$this->get('/', 'LogViewerController@listLogs')
->name('list'); // foundation::system.log-viewer.logs.list

$this->group(['prefix' => '{date}'], function() {
$this->prefix('{date}')->group(function() {
$this->get('/', 'LogViewerController@show')
->name('show'); // foundation::system.log-viewer.logs.show

Expand All @@ -79,9 +76,9 @@ private function registerLogViewerRoutes()
*/
private function registerRouteViewerRoutes()
{
$this->group(['prefix' => 'routes', 'as' => 'routes.'], function () {
$this->prefix('routes')->name('routes.')->group(function () {
$this->get('/', 'RoutesController@index')
->name('index');
->name('index'); // foundation::system.routes.index
});
}
}
2 changes: 1 addition & 1 deletion tests/FoundationServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function it_can_be_instantiated()
public function it_can_provides()
{
$expected = [
'arcanesoft.foundation',
\Arcanesoft\Foundation\Contracts\Foundation::class,
];

$this->assertEquals($expected, $this->provider->provides());
Expand Down
2 changes: 1 addition & 1 deletion tests/FoundationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function setUp()
{
parent::setUp();

$this->foundation = app('arcanesoft.foundation');
$this->foundation = $this->app->make(\Arcanesoft\Foundation\Contracts\Foundation::class);
}

public function tearDown()
Expand Down

0 comments on commit 77d85c3

Please sign in to comment.