I can't seem to figure out what's wrong with this code. I'm running laravel 5.4.
The error: http://ift.tt/2m4rk2X
The Controller function:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Thread;
class ThreadController extends Controller
{
public function show($id) {
return Thread::where('id', '=', $id)->messages();
}
}
The Model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Thread extends Model
{
public function messages()
{
return $this->hasMany(Message::class)->get();
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire