user12519756
user12519756

Reputation:

how fix artisan error ? UnexpectedValueException

when I want use PHP artisan, I have one error, it is : php artisan error pic

Upvotes: 1

Views: 810

Answers (2)

Foued MOUSSI
Foued MOUSSI

Reputation: 4813

Single Action Controllers

If you would like to define a controller that only handles a single action, you may place a single __invoke method on the controller:

<?php

namespace App\Http\Controllers\Auth;

//...
use App\Http\Controllers\Controller;
//...

class Goo extends Controller
{

    public function __invoke()
    {
        // Your code goes here
    }
}

When registering routes for single action controllers, you do not need to specify a method:

Route::get('Uri', 'Auth\Goo');

Documentation

Upvotes: 0

tamrat
tamrat

Reputation: 1940

This is probably because you have defined routes in your routes/web.php or routes/api.php file with invokable or resourceful controllers that don't exist yet. For example, this would throw an error if the PhotoController doesn't exist.

Route::get('/test', 'PhotoController');

But this wouldn't.

Route::get('/test', 'PhotoController@store');

So make sure your controllers are defined correctly. If you are specifying resourceful or invokable controllers, make sure to create them first.

Upvotes: 3

Related Questions