Skip to main content Skip to navigation

Guides: What are flows?

Flows are the part of Hiker that allow you to interact with your resources.

Creating a flows repository

To create a flows repository, use the trail:flows Artisan command:

php artisan trail:flows User

This command will create the Hiker/Resources/Users/UserFlows.php file for you.

class UserFlows extends FlowsRepository
{
    public function draft(): Roadmap
    {
        return roadmap()
            ->setTransitory()
            //
            ->chain('create');
    }

    public function create(): Roadmap
    {
        return roadmap()
            //
            ->chain('read');
    }

    public function edit(): Roadmap
    {
        return roadmap()
            ->setTransitory()
            //
            ->chain('update');
    }

    public function update(): Roadmap
    {
        return roadmap()
            //
            ->chain('read');
    }

    public function read(): Roadmap
    {
        return roadmap()
            ->setTransitory();
    }

    public function remove(): Roadmap
    {
        return roadmap()
            ->setTransitory()
            //
            ->chain('delete');
    }

    public function delete(): Roadmap
    {
        return roadmap()
            //
            ->chain('index');
    }
}

TODO.