diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml
index fdca3d9..1ed998f 100644
--- a/.github/workflows/phpunit.yml
+++ b/.github/workflows/phpunit.yml
@@ -2,51 +2,16 @@ name: phpunit
on: [ push ]
jobs:
- laravel_7x:
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: true
- matrix:
- php: [ "7.2", "7.3", "7.4", "8.0" ]
- laravel: [ "^7.0" ]
-
- name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }}
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php }}
- extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
- coverage: xdebug
-
- - name: Composer self update
- run: composer self-update
-
- - name: Install dependencies
- run: |
- composer require laravel/framework:${{ matrix.laravel }}
- composer update --prefer-stable --prefer-dist --no-progress --no-interaction
-
- - name: Execute tests
- run: |
- mkdir -p build/logs
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
-
- laravel_8x:
+ phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ "7.3", "7.4", "8.0" ]
- laravel: [ "^8.0" ]
+ laravel: [ "^7.0", "^8.0" ]
- name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }}
+ name: PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
@@ -59,15 +24,8 @@ jobs:
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
coverage: xdebug
- - name: Composer self update
- run: composer self-update
-
- name: Install dependencies
- run: |
- composer require laravel/framework:${{ matrix.laravel }}
- composer update --prefer-stable --prefer-dist --no-progress --no-interaction
+ run: composer require --dev laravel/framework:${{ matrix.laravel }}
- name: Execute tests
- run: |
- mkdir -p build/logs
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
+ run: sudo vendor/bin/phpunit
diff --git a/README.md b/README.md
index a593443..4e3523b 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,14 @@
## Extended Routes
-This helper extends the standard set of resource routing methods to work with SoftDeletes and other extends.
-
-
-
-
-
-
-
-
-
+[![Stable Version][badge_stable]][link_packagist]
+[![Unstable Version][badge_unstable]][link_packagist]
+[![Total Downloads][badge_downloads]][link_packagist]
+[![Github Workflow Status][badge_build]][link_build]
+[![License][badge_license]][link_license]
+
+> This helper extends the standard set of resource routing methods to work with SoftDeletes and other extends.
## Installation
@@ -19,7 +16,7 @@ This helper extends the standard set of resource routing methods to work with So
To get the latest version of `Extended Routes`, simply require the project using [Composer](https://getcomposer.org):
```bash
-$ composer require andrey-helldar/extended-routes
+$ composer require dragon-code/extended-routes
```
Instead, you may of course manually update your require block and run `composer update` if you so choose:
@@ -27,38 +24,36 @@ Instead, you may of course manually update your require block and run `composer
```json
{
"require": {
- "andrey-helldar/extended-routes": "^2.0"
+ "dragon-code/extended-routes": "^3.0"
}
}
```
-For Laravel 5.4 - 6.x use `^1.0` version.
+### Upgrade from `andrey-helldar/extended-routes`
+1. In your `composer.json` file, replace `"andrey-helldar/extended-routes": "^2.0"` with `"dragon-code/extended-routes": "^3.0"`.
+2. Replace the `Helldar\ExtendedRoutes` namespace prefix with `DragonCode\ExtendedRoutes` in your app;
+3. Run the `command composer` update.
+4. Profit!
## Using
-Add to BaseModel method
+### With trait
```php
-use Helldar\ExtendedRoutes\Routing\ModelBindingResolver;
-use Illuminate\Database\Eloquent\SoftDeletes;
+use DragonCode\ExtendedRoutes\Routing\ModelBindingResolver;
+use DragonCode\ExtendedRoutes\Traits\ExtendedSoftDeletes;
class Page extends Model
{
- use SoftDeletes;
-
- public function resolveRouteBinding($value, $field = null)
- {
- return (new ModelBindingResolver($this))
- ->resolve($value, $field);
- }
+ use ExtendedSoftDeletes;
}
```
-or change extends of model:
+### Extends of the abstract model
```php
-use Helldar\ExtendedRoutes\Models\ExtendedSoftDeletes;
+use DragonCode\ExtendedRoutes\Models\ExtendedSoftDeletes;
//use Illuminate\Database\Eloquent\SoftDeletes;
class Foo extends ExtendedSoftDeletes
@@ -67,26 +62,26 @@ class Foo extends ExtendedSoftDeletes
}
```
-or using trait:
+### Routes
```php
-use Helldar\ExtendedRoutes\Traits\ExtendedSoftDeletes;
-//use Illuminate\Database\Eloquent\SoftDeletes; << need to remove conflicting trait.
+app('router')->apiRestorableResource('foos', 'FoosController');
-class Foo extends Model
-{
- use ExtendedSoftDeletes;
-}
+// or
+
+Route::apiRestorableResource('foos', 'FoosController');
```
-and for some model Foo with SoftDeletes trait we can add routes:
+Referencing is also available:
```php
-app('router')->apiRestorableResource('foos', 'FoosController');
+use App\Http\Controllers\FoosController;
+
+app('router')->apiRestorableResource('foos', FoosController::class);
// or
-Route::apiRestorableResource('foos', 'FoosController');
+Route::apiRestorableResource('foos', FoosController::class);
```
| Method | URI | Name | Action | Middleware |
@@ -99,9 +94,25 @@ Route::apiRestorableResource('foos', 'FoosController');
| DELETE | api/foos/{foo} | foos.destroy | App\Http\Controllers\FoosController@destroy | api |
| POST | api/foos/{foo}/restore | foos.restore | App\Http\Controllers\FoosController@restore | api |
-
## License
This package is licensed under the [MIT License](LICENSE).
This package was written with the participation of [Maksim (Ellrion) Platonov](https://github.com/Ellrion) under [MIT License](LICENSE).
+
+
+[badge_build]: https://img.shields.io/github/workflow/status/TheDragonCode/extended-routes/phpunit?style=flat-square
+
+[badge_downloads]: https://img.shields.io/packagist/dt/dragon-code/extended-routes.svg?style=flat-square
+
+[badge_license]: https://img.shields.io/packagist/l/dragon-code/extended-routes.svg?style=flat-square
+
+[badge_stable]: https://img.shields.io/github/v/release/TheDragonCode/extended-routes?label=stable&style=flat-square
+
+[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square
+
+[link_build]: https://github.com/TheDragonCode/extended-routes/actions
+
+[link_license]: LICENSE
+
+[link_packagist]: https://packagist.org/packages/dragon-code/extended-routes
diff --git a/SECURITY.md b/SECURITY.md
deleted file mode 100644
index 7ad007f..0000000
--- a/SECURITY.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Security Policy
-
-To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
-
-Tidelift will coordinate the fix and disclosure.
diff --git a/composer.json b/composer.json
index 48019fd..e036509 100644
--- a/composer.json
+++ b/composer.json
@@ -1,12 +1,12 @@
{
- "name": "andrey-helldar/extended-routes",
+ "name": "dragon-code/extended-routes",
"description": "This helper extends the standard set of resource routing methods to work with SoftDeletes and other extends",
"type": "library",
"license": "MIT",
- "keywords": ["extended routes", "resource", "routes", "router", "laravel"],
+ "keywords": ["extended routes", "resource", "routes", "router", "laravel", "dragon-code", "dragon", "andrey-helldar"],
"support": {
- "issues": "https://github.com/andrey-helldar/extended-routes/issues",
- "source": "https://github.com/andrey-helldar/extended-routes"
+ "issues": "https://github.com/TheDragonCode/extended-routes/issues",
+ "source": "https://github.com/TheDragonCode/extended-routes"
},
"authors": [
{
@@ -19,21 +19,18 @@
}
],
"require": {
- "php": "^7.2.5|^8.0",
- "illuminate/routing": "^7.30.4|^8.24",
- "illuminate/support": "^7.30.4|^8.24",
- "illuminate/database": "^7.30.4|^8.24"
+ "php": "^7.3|^8.0",
+ "illuminate/routing": "^7.0|^8.0",
+ "illuminate/support": "^7.0|^8.0",
+ "illuminate/database": "^7.0|^8.0"
},
"require-dev": {
"orchestra/testbench": "^5.0|^6.0",
- "phpunit/phpunit": "^8.0|^9.0"
- },
- "suggest": {
- "symfony/thanks": "Give thanks (in the form of a GitHub) to your fellow PHP package maintainers"
+ "phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
- "Helldar\\ExtendedRoutes\\": "src"
+ "DragonCode\\ExtendedRoutes\\": "src"
}
},
"autoload-dev": {
@@ -49,7 +46,7 @@
"extra": {
"laravel": {
"providers": [
- "Helldar\\ExtendedRoutes\\ServiceProvider"
+ "DragonCode\\ExtendedRoutes\\ServiceProvider"
]
}
}
diff --git a/phpunit.xml b/phpunit.xml
index 0bbe36e..9b70287 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,16 +1,31 @@
-
+
+
+ ./src
+
+
+ src/ServiceProvider.php
+
+
+
+
+
+
+
@@ -21,17 +36,4 @@
./tests
-
-
- ./src
-
- src/ServiceProvider.php
-
-
-
-
-
-
-
-
diff --git a/src/Contracts/Route.php b/src/Contracts/Route.php
index 8199995..50defb8 100644
--- a/src/Contracts/Route.php
+++ b/src/Contracts/Route.php
@@ -1,6 +1,6 @@
registerResourceRegistrar();
$this->registerRouterMacro();
}
- /**
- * Register resource registrar.
- */
protected function registerResourceRegistrar()
{
$this->app->bind(ResourceRegistrar::class, ExtendedResourceRegistrar::class);
}
- /**
- * Add macro to router.
- *
- * @throws \ReflectionException
- */
protected function registerRouterMacro()
{
Router::mixin($this->mixin());
diff --git a/src/Traits/ExtendedSoftDeletes.php b/src/Traits/ExtendedSoftDeletes.php
index 2535224..6b94ee6 100644
--- a/src/Traits/ExtendedSoftDeletes.php
+++ b/src/Traits/ExtendedSoftDeletes.php
@@ -1,8 +1,8 @@
$this])
- ->resolve($value, $field);
- }
-}
diff --git a/tests/Features/RoutesTest.php b/tests/Features/RoutesTest.php
index 7d26160..5ff2361 100644
--- a/tests/Features/RoutesTest.php
+++ b/tests/Features/RoutesTest.php
@@ -5,7 +5,7 @@
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
-final class RoutesTest extends TestCase
+class RoutesTest extends TestCase
{
public function testNames()
{
diff --git a/tests/TestCase.php b/tests/TestCase.php
index fc99f7c..3576dd1 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -2,13 +2,13 @@
namespace Tests;
-use Helldar\ExtendedRoutes\ServiceProvider;
+use DragonCode\ExtendedRoutes\ServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;
use Tests\Fixtures\Controller;
abstract class TestCase extends BaseTestCase
{
- protected function getPackageProviders($app)
+ protected function getPackageProviders($app): array
{
return [ServiceProvider::class];
}