#Target [App\Enums\*] is not instantiable.

3 messages · Page 1 of 1 (latest)

plain ingot
#
Illuminate\Contracts\Container\BindingResolutionException

Target [App\Enums\PlaceType] is not instantiable.
    Route::get('places/type/{placeType}', function (PlaceType $type) {

    return $type->value;

})->name('ofType');

....


namespace App\Enums;

enum PlaceType: string
{
    case RELIGION = 'religion';
    case PROFESSION = 'profession';
    case HISTORY = 'history';
    case NATURE = 'nature';
    case FOOD_DRINKS = 'food_drinks';

    /**
     * Get the translated label for the enum.
     */
    public function label(): string
    {
        return match ($this) {
            self::RELIGION => __('Religion'),
            self::PROFESSION => __('Profession'),
            self::HISTORY => __('History'),
            self::NATURE => __('Nature'),
            self::FOOD_DRINKS => __('Food & Drinks'),
        };
    }




narrow ermine
#

Which Laravel version are you using?

plain ingot
#

placeType -> type and it worked