I'm having a trouble using a model in a controller in Laravel 5.0. I created the model in a folder model under App. The code of the model id described as:
<?php namespace App\models;
use Illuminate\Database\Eloquent\Model;
class Observacion extends Model{
protected $table = 'obs_usuarios';
protected $fillable = ['observaciones', 'usuario_id','autor_id','tipo'];
}
Part of the code of the controller where I pretend to use it, is:
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\models\Contrato;
use app\models\Observacion;
use App\models\Perfil;
use Illuminate\Http\Request;
use App\models\Configuracion;
use App\models\Usuario;
use App\models\Categ_profesores;
use Carbon\Carbon;
use Illuminate\Support\Facades\Input;
use Auth;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class SecretariaController extends Controller {
public function observacion($msg,$user_id,$autor_id,$type){
$observacion = new Observacion();
$observacion->observaciones=$msg;
$observacion->usuario_id=$user_id;
$observacion->autor_id=$autor_id;
$observacion->tipo=$type;
$observacion->save();
}
I even made dump-autoload
but I get this error:
FatalErrorException in SecretariaController.php line 155:
Class 'app\models\Observacion' not found
The line 155 is where I do: $observacion = new Observacion();
So, I don't know what else to check.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1lvCJF2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire