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: Actions weight: 3

Next to controllers, you can also add actions to an links group:

class UserResource extends JsonResource
{
    use HasLinks;

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

Is possible to specify the parameters for the links:

$links
    ->action([UsersController::class, 'create'])
    ->parameters(User::first());

Or prefix the link:

$links
    ->action([UsersController::class, 'create'])
    ->prefix('admin');

The name of the action can also be changed:

$links
    ->action([UsersController::class, 'create'])
    ->name('build');

Changing the Http verb(POST, GET, …) of the action can be done as such:

$links
    ->action([UsersController::class, 'create'])
    ->httpVerb('POST');
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport