Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iboosensei's avatar

Undefined type 'App\AccountData

Hello everyone. I'm reading the documentation of Laravel Nova about the actions, at this adress : https://nova.laravel.com/docs/2.0/actions/defining-actions.html#action-fields

At this point, it's asked to use App\AccountData in the handle function of acton called ``` EmailAccountProfile.php. The path of the file is : app/Nova/Actions

But when I do it, I get a "Undefined type 'App\AccountData'" error.

My EmailAccountProfile.php file :

<?php

namespace App\Nova\Actions;

use App\AccountData;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;

class EmailAccountProfile extends Action
{
    use InteractsWithQueue, Queueable;

    /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
        foreach ($models as $model) {
            (new AccountData($model))->send();
          }
    }

    /**
     * Get the fields available on the action.
     *
     * @return array
     */
    public function fields()
    {
        return [];
    }
}


0 likes
6 replies
iboosensei's avatar

The location and the content of the file are given in the doc. Only the namespace.

iboosensei's avatar

I found the problem. We have to use User instead of AccountData.

iboosensei's avatar

Can somebody explain me how to close the conversation ?

Please or to participate in this conversation.