Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Resource Endpoints Laravel Package

spatie/laravel-resource-endpoints

Abandoned package that adds controller-based “links” and collection “meta” links to Laravel API Resources. Automatically generates URLs for actions like index/show/edit/update/delete, so resources can expose REST endpoints without manually building routes.

View on GitHub
Deep Wiki
Context7

title: Invokable controllers weight: 4

Invokable controllers can be written as actions

class UserResource extends JsonResource
{
    use HasLinks;

    public function toArray($request)
    {
        return [
            'links' => $this->links(function (Links $links) {
                $links->action(DownloadUserController::class);
            }),
        ];
    }
}

By default the __invoke() method of this controller will be created with the name `invoke. This will produce following JSON:

"links": {
    "invoke": {
       "method": "GET",
       "action": "https://laravel.app/admin/users/1/download"
    },
}

Want to be more explicit? You can also add an invokable controller to a link group as such:

$links->controller(DownloadUserController::class);

Off course you can use the methods defined by an action on this controller:

$links
    ->controller(DownloadUserController::class)
    ->name('download');
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony