I have a model called Round (below) that has a one to many relationship with the model User.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Round extends Model
{
/**
* A round is played by a user.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user() {
return $this->belongsTo('App/User');
}
In my RoundsController, I have a show() function attempting to return the user of a particular round.
<?php
namespace App\Http\Controllers;
use App\Round;
use Illuminate\Http\Request;
use App\Http\Requests;
class RoundsController extends Controller
{
public function show($id)
{
return Round::find($id)->user();
}
When i attempt to do this I get a FatalErrorException - class 'App/User' not found in Model.php
I know this is usually a namespace issue, but all my models are in the 'App' namespace. When I try something like Round::find($id), it works just find. It only seems to break down when I try and use relationships. I've googled around and am struggling to find an answer.
Thanks for the help.