Skip to content

[future] Improve routing #2203

Open
Open
@aksiome

Description

@aksiome

Summary

I think that the router should be reworked to allow new options (like uses) and match a bit more how resources work in laravel. The motivation for this came while developing a package where I had to manually register all routes because I needed a custom controller.

The idea is to allow both an options array and chained methods:

TwillRoutes::module('foo', ['uses' => 'foocontroller', 'only' => []])->except()->middleware()->parameters()->...

Also by not depending on resource routes and merging the resources_options array with the options array we could have more coherent urls and avoid having these 2 kind of patterns in nested modules:

  • posts/{post}/tests/{test}
  • posts/tests/duplicate/{id}

An other goal is to avoid registering useless routes. For example a singleton does not need the restore method or bulk actions.

I'm happy to work on a PR for it, I actually started one #2157 but I should not have pulled directly on 3.x without talking about it first and it's for sure something for a future update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Beyond

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions