Hi im a beginner in laravel. I am receiving an error Trying to get property of non-object. Please help me out. Thanks in advance!
Below are my routes
use App\Post;
use App\User;
Route::get('/user/{id}/post', function($id){
$post = User::find(1)->post;
});
Below are my users
public function post(){
return $this->hasOne('App/Post');
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28OTfvn
via IFTTT
Aucun commentaire:
Enregistrer un commentaire