model user
protected $table = "users";
protected $fillable = ['name', 'email', 'password' ];
protected $hidden = [
'password', 'remember_token',
];
public function solicitud(){
return $this->hasMany('App\solicitud');
}
Model tiposolicitud
protected $table = "tiposolicitud";
protected $fillable = ['nombre'];
public function solicitud(){
return $this->hasMany('App\solicitud');
}
Model solicitud ( principal )
protected $table = "solicitud";
protected $fillable = [..extract... 'tiposolicitud_id','users_id'....];
public function tiposolicitud(){
return $this->belongsTo('App\tiposolicitud');
}
public function User(){
return $this->belongsTo('App\User');
}
Controller ( extract)
use App\solicitud as VarModel;
use App\User;
use App\tiposolicitud ;
...
public function index()
{
$var1 = VarModel::all();
return view('private.solicitud.index',compact('var1'));
}
index.php
@foreach ($var1 as $var)
<tr>
<td></td> // OK
<td></td> //NOT OK
<td></td> // OK
Trying to get property of non-object (View: C:\wamp64\www\issdgr\resources\views\private\solicitud\index.blade.php)
I have problem with app / user
I have persisted the id of the user but I can not find the name ..
HELP!!!!!
via Daniel Alejandro Godoy Rios