Laravel - Type error: Too few arguments?

Viewed 67390

I get an error:

Type error: Too few arguments

I thought Laravel do some magic to if arguments is not fully passed?

For example:

In the Controller I have:

public function create(CreateRequest $request)
{
    return $this->todoService->createList($request);
}

In the todoService class:

use App\Plan

class todoService {   

    public function createList($request, Plan $plan)
    {
      //
    }
}

As you can see I did not pass Plan class object. Do I have to bind or something?

4 Answers

1

/**
 * Create a new personal access token for the user.
 *
 * @param  string  $name
 * @param  array  $scopes
 * @return \Laravel\Passport\PersonalAccessTokenResult
 */
public function createToken($name, array $scopes = [])
{
    return Container::getInstance()->make(PersonalAccessTokenFactory::class)->make(
        $this->getKey(), $name, $scopes
    );
}

/**
 * Set the current access token for the user.
 *
 * @param  \Laravel\Passport\Token  $accessToken
 * @return $this
Related