Reputation: 141
The problem is that I add the relationships to my models and PHPstorm says that the function rooms is a 'Unused element' and the relation doe snot work.
I already went through the documentation of laravel and searched google for a solutions
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Type extends Model
{
public function rooms()
{
return $this->hasMany('App\Room');
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Room extends Model
{
public function type(){
return $this->belongsTo('App\room');
}
}
The relation should give the room numbers on my view and currently it is blank
Upvotes: 0
Views: 243
Reputation: 4388
It's Seems you mentioned the wrong relationship in the type method.
public function type(){
return $this->belongsTo('App\Type');
}
Upvotes: 3