I have a problem. I need to return the values of a relationship, however, it has the following error:
ErrorException
Undefined property: Illuminate\Database\Eloquent\Collection::$fileServico
My code:
FileClass.php
public function fileServico(){
return $this->hasMany('File');
}
FileServico.php
public function file(){
return $this->belongsTo('File');
}
You can have multiple FileServices for a FileClass. As I'm calling:
ReservationController.php
public function getIndex(){
return View::make('home')->with('file',FileClass::all()->fileServico);
}