I went through this post... Laravel - name a model using a reserved word
But this doesn't provide a solution of defining relationships.
I have a Model name Class.php
And I have to Relate it with Student & ClassAllocation
Here is my Relationship defined in Student.php:
/**
* Check the Class allocated to Student
*
*@return void
*/
public function class()
{
return $this->belongsToMany('App\Class', 'class_allocations');
}
I have tried everything and I don't want to change my Model name now. How do I make this work? I keep getting this error on tinker:
PHP Error: syntax error, unexpected 'Class' (T_CLASS), expecting identifier (T_STRING) in /home/vagrant/Homestead/app/app/Class.php on line 7