mercredi 25 novembre 2015

laravel named routing for package

I have been working with laravel 5 for package development.So i created a package with composer as 'lakshmajim/testview'.

the I have cloned that package for testing by creating fresh laravel project

composer require lakshmajim/testview dev-master

then updated composer.json main file like this

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/",
        "lakshmajim\\testview\\": "vendor/lakshmajim/testview/src"   
    }
},

then i have done

composer dumpautoload 
composer update 
php artisan vendor:publish

My routes (php artisan route:list)

    +--------+----------+-----------------+-------------------------+------------+
|Domain|Method | URI              |Name| Action                                      | Middleware |
    +--------+----------+-----------------+------+----------+------------+
|     | GET|HEAD| /              |     | Closure                       
|     | GET|HEAD| accessurl/{str}|     | lakshmajim\testview\TestviewController@index | |    
|     | GET|HEAD| hi             |     | App\Http\Controllers\Controller@e            |            |

When I tried to access http://localhost:8000/accessurl/any%20parameter%20here it works fine and shows result.

my controller file

use Redirect;

class Controller extends BaseController
{ 
        public function e()
        {
            $url='accessurl/strtestpackage';
            return Redirect::route($url);
        }
}

The problem is when I 'm trying to access package route form controller it shows following error

`**InvalidArgumentException in UrlGenerator.php line 296: Route [accessurl/str] not defined**`.

QUESTION How can I able to access named route present in vendor directory form controller? (How can I use vendor/lakshmajim/testview/src/routes.php file from app/Http/Controllers/Controller.php?)

Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/21hd3wB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire