andrey-helldar/extended-routes

This package is abandoned and no longer maintained. The author suggests using the dragon-code/extended-routes package instead.

This helper extends the standard set of resource routing methods to work with SoftDeletes and other extends

4.0.1 2024-03-15 00:21 UTC

README

Extended Routes

Stable Version Unstable Version Total Downloads Github Workflow Status License

This helper extends the standard set of resource routing methods to work with SoftDeletes and other extends.

Installation

Compatibility

Laravel PHP Extended Routes Version
7, 8, 9, 10 7.3, 7.4, 8.0, 8.1, 8.2 ^3.0
10, 11 8.1, 8.2, 8.3 ^4.0

To get the latest version of Extended Routes, simply require the project using Composer:

$ composer require dragon-code/extended-routes

Instead, you may of course manually update your require block and run composer update if you so choose:

{
    "require": {
        "dragon-code/extended-routes": "^4.0"
    }
}

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

With trait

use DragonCode\ExtendedRoutes\Routing\ModelBindingResolver;
use DragonCode\ExtendedRoutes\Traits\ExtendedSoftDeletes;

class Page extends Model
{
    use ExtendedSoftDeletes;
}

Extends of the abstract model

use DragonCode\ExtendedRoutes\Models\ExtendedSoftDeletes;
//use Illuminate\Database\Eloquent\SoftDeletes;

class Foo extends ExtendedSoftDeletes
{
    //use SoftDeletes; << need to remove conflicting trait.
}

Routes

app('router')->apiRestorableResource('foos', 'FoosController');

// or

Route::apiRestorableResource('foos', 'FoosController');

Referencing is also available:

use App\Http\Controllers\FoosController;

app('router')->apiRestorableResource('foos', FoosController::class);

// or

Route::apiRestorableResource('foos', FoosController::class);
Method URI Name Action Middleware
GET/HEAD api/foos foos.index App\Http\Controllers\FoosController@index api
POST api/foos foos.store App\Http\Controllers\FoosController@store api
GET/HEAD api/foos/trashed foos.trashed App\Http\Controllers\FoosController@trashed api
GET/HEAD api/foos/{foo} foos.show App\Http\Controllers\FoosController@show api
PUT/PATCH api/foos/{foo} foos.update App\Http\Controllers\FoosController@update api
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.

This package was written with the participation of Maksim (Ellrion) Platonov under MIT License.