Skip to main content Skip to navigation

Components: MakesRequests

How to use

Components that use this trait allow you to call flows and make HTTP requests.

Available methods

href(string $href): static

Set a URL as the target. Meant for internal navigation only.

Component::make()
    ->href(route('...'))

external(string $href): static

Set an external URL as the target.

Component::make()
    ->external('https://hiker.dev')

route(string $route, array $parameters = []): static

Set the href using a route.

Component::make()
    ->route('contact')

flow(Resource $resource, string $flow): static

Method to activate a specific flow for the given resource.

Component::make()
    ->flow($category, 'edit')

data(?array $data = null): static

Set data that should be sent along with the request. This data will be injected into the baggage.

Component::make()
    ->draft(App\Hiker\Resources\Categories\Category::class)
    ->data(['title' => 'Front-end'])

read(?Hiker\Resource $resource): static

Shortcut to activate the read flow for the given resource.

Component::make()
    ->read($category)

draft(Resource $resource): static

Shortcut to activate the draft flow for the given resource.

Component::make()
    ->draft(App\Hiker\Resources\Categories\Category::class)

index(Resource $resource): static

Shortcut to activate the index flow for the given resource.

Component::make()
    ->index(App\Hiker\Resources\Categories\Category::class)