dimanche 3 décembre 2017

Fatal error: Uncaught Error: Class Model not found in Laravel

I follow the official documentation of Laravel in order to create the Model class. I use the php artisan make:model model_name command to create model

ListingModel.php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ListingModel extends Model
{
    //
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'table_name';
}

Then I use the below class to get the data

use App\ListingModel;

$items= App\ListingModel::all();

foreach ($itemsas $item) {
    echo $item->name;
}

When I try to call the above file it always display Fatal error

Fatal error: Uncaught Error: Class 'App\ListingModel' not found 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire