[previous exception] [object] (Error(code: 0): Class "App\Promotes" not found #5389
-
Description:Laravel nova works on my local, but when I open nova on the server I got this error. "[previous exception] [object] (Error(code: 0): Class "App\Promotes" not found at /home/forge/tailwindcomponents.com/vendor/laravel/nova/src/Resource.php:397) I have model App\Promote, when I open /vendor/composer/autoload_classmap.php I see there are loads for App\Promotes but I didn't have this class in my project. Promote Model<?php
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Promote extends Model
{
use HasFactory;
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
public function scopePublished($scope)
{
return $scope->where('publish', true);
}
} Promote Nova Model<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Image;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Textarea;
class Promote extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = \App\Promote::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id',
'name',
];
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make(__('ID'), 'id')->sortable(),
Text::make('name'),
Textarea::make('description'),
Image::make('image'),
Text::make('company_name'),
Text::make('url'),
Text::make('visits'),
Text::make('price'),
Boolean::make('publish'),
];
}
/**
* Get the cards available for the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function cards(Request $request)
{
return [];
}
/**
* Get the filters available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function filters(Request $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function lenses(Request $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function actions(Request $request)
{
return [];
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I can only confirm that there's nothing in Nova's source code that would cause this issue and autoloading is controlled via Composer. This is probably a usage issue and you need to debug your code. |
Beta Was this translation helpful? Give feedback.
I can only confirm that there's nothing in Nova's source code that would cause this issue and autoloading is controlled via Composer. This is probably a usage issue and you need to debug your code.