Skip to content

make a single resource route #112

@pishguy

Description

@pishguy

in this code when i scan route, that make some routes for all of resource http verbs, for example:

/**
 * Class AdminController
 * @package App\Http\Controllers\Backend
 * @Resource("/post")
 */

routes.scanned.php contains:

<?php 

// Resource: /post@index
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['index'], 'names' => []]);
});

// Resource: /post@create
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['create'], 'names' => []]);
});

// Resource: /post@store
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['store'], 'names' => []]);
});

// Resource: /post@show
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['show'], 'names' => []]);
});

// Resource: /post@edit
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['edit'], 'names' => []]);
});

// Resource: /post@update
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['update'], 'names' => []]);
});

// Resource: /post@destroy
$router->group(['middleware' => [], 'prefix' => NULL, 'where' => [], 'domain' => NULL], function() use ($router)
{
	$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController', ['only' => ['destroy'], 'names' => []]);
});

that should be only one router:

$router->resource('/post', 'App\\Http\\Controllers\\Backend\\AdminController');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions