Creating Front-End for Custom Modules



  • Hello,

    I have the following front end route

    $router->post('requests', [
            'as' => 'brokerquotes.request.store',
            'uses' => 'RequestController@store',
            //'middleware' => 'can:brokerquotes.requests.create'
        ]);
    

    In trying to navigate to this route using POST I keep getting the following

    (1/1) NotFoundHttpException
    in RouteCollection.php (line 179)
    at RouteCollection->match(object(Request))
    in Router.php (line 548)
    at Router->findRoute(object(Request))
    in Router.php (line 527)
    at Router->dispatchToRoute(object(Request))
    in Router.php (line 513)
    at Router->dispatch(object(Request))
    in Kernel.php (line 174)
    at Kernel->Illuminate\Foundation\Http{closure}(object(Request))
    in Pipeline.php (line 30)
    at Pipeline->Illuminate\Routing{closure}(object(Request))
    in Debugbar.php (line 51)
    at Debugbar->handle(object(Request), object(Closure))
    in Pipeline.php (line 148)
    at Pipeline->Illuminate\Pipeline{closure}(object(Request))
    in Pipeline.php (line 53)
    at Pipeline->Illuminate\Routing{closure}(object(Request))
    in CheckForMaintenanceMode.php (line 46)
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    in Pipeline.php (line 148)
    at Pipeline->Illuminate\Pipeline{closure}(object(Request))
    in Pipeline.php (line 53)
    at Pipeline->Illuminate\Routing{closure}(object(Request))
    in Pipeline.php (line 102)
    at Pipeline->then(object(Closure))
    in Kernel.php (line 149)
    at Kernel->sendRequestThroughRouter(object(Request))
    in Kernel.php (line 116)
    at Kernel->handle(object(Request))
    in index.php (line 53)

    I have not been able to assertain why this is happening the following is my Headers are as follows

    POST /en/brokerquotes/requests/ HTTP/1.1
    Connection: keep-alive
    Content-Length: 56
    Pragma: no-cache
    Cache-Control: no-cache
    Origin: null
    set-cookie: XSRF-TOKEN=eyJpdiI6ImdTakNzTWdaOWpKVFZBYllPd1JKMEE9PSIsInZhbHVlIjoibEo4WEVMejdmUmlVQjRoS3dEN05mb0ZkZlhrU1FSYU4rb01kQlZkc2pWazhuV3BzcGowaXgzNTBcL1B2STdwSTNHbGRoQkdxaldWenRtanNxMTJ4d1NnPT0iLCJtYWMiOiIwM2QzZGViNjdhZTAzZWQ5NzkyM2EyZDgwMTcyYjI3YmQ2NDE2ZmIwMGZmYTgyNThiYmI3N2ViNDJkZjMyODFkIn0%3D; laravel_session=eyJpdiI6Im1naWVDcGxCaWlOMGpFbVFQT0JCM1E9PSIsInZhbHVlIjoiWFBCTU9QY1hxazdBWUxRR3dxOU9sQkNvTWhlSTVVNFd5NUwzVzFobnRMNG1oODF2VE9LTXpQaGV4aFlqUVczdTRGUlB0UDJpOFkwWk43eDNEbkl2bmc9PSIsIm1hYyI6ImZlYWI0NzljYWUzNzRlMzFiNmRkNTVkMDc2YjY1NDNiZmViYmI5ZTZjYWFlZTNmOTk5NTBlMzE2MDE5NDM5ZjQifQ%3D%3D
    User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
    content-type: application/x-www-urlencoded
    Accept: /
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,en;q=0.8
    Cookie: XSRF-TOKEN=eyJpdiI6Ijl0eEpNZFBhejVFOEZLNUJVUVwvaTZ3PT0iLCJ2YWx1ZSI6InpNMnRZVFYramRVR1NtN21zSHhYVEU5b3llQStKWlMxcGQ5cTgyeWRWQTd1bWZkTlllY0owRUlOUzlnY2g0blhFUUNtOTlMNEZtQ0ViSDgxSXkzd3NRPT0iLCJtYWMiOiIyYTkxOTc2ZWRjNmM0MzMzZTJiYTI3OWEyYjI4ZGY0OWMxZDQwN2QyNGZkYTVhZWYyZmM0NDI3MTg3NDNkMjc4In0%3D; laravel_session=eyJpdiI6Ik1xTlUyOEdFQ0RkQ3BPeWN3RVJHYnc9PSIsInZhbHVlIjoiME9vb0F3UDJyK0NxVE15RWZjZE9aS3d0d0o4eHVYNWFGY2NzMTU4QXo3WW5tNUM3VlNQVVhMc3FJR1QwTmpoTTY4ZUpXK2lhS096bmo3eDZVMkdqWlE9PSIsIm1hYyI6IjA4NTM0MzEyODg2M2MyOTdjODIxY2UyZTNjMWI2NTAwMzZmNTMyMDUwMzI4Y2E1MWNhZGU2MGQ5NmU2MTcyZmIifQ%3D%3D
    Request Payload
    tesy=bar&_token=g6FJomeuEjxhMYZrOJiUGyBPwcOPZBe1ztSL12F7

    Is there anything that needs to be done or set when POSTing to front end routes?


  • admin

    Hi,

    There is nothing special to do no. Except loading the frontend routes file, in case you created one.

    In the route service provider of your module, you can set the frontendRoutes method to return your file, which will load it. Here is an example


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.