Reputation: 309
When i execute my code that returns:
Class 'app\Nota' not found
I try use app\Notas::all();
instead app\Nota::all();
, in the controller, but didn't work. I try too use app\Notas;
instead app\Nota;
but didn't worked for me.
My model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Nota extends Model
{
//
}
My controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use app\Nota;
class productoController extends Controller
{
public function show($id){
$notas = app\Nota::all();
print_r($notas);
die;
}
}
What can be the problem?
Upvotes: 1
Views: 888
Reputation: 58
Try using the following:
$notas = Nota::all();
and replace use app\Nota;
by use App\Nota;
Upvotes: 0
Reputation: 3751
Replace your controller code like -
<?php
namespace App\Http\Controllers;
use App\Nota;
use Illuminate\Http\Request;
class productoController extends Controller
{
public function show($id){
$notas = Nota::all();
dd($notas);
}
}
Upvotes: 1