This is my model:
class Product extends \\GlobalModel {
protected $table = \'product\';
}
I want to update the table name oops_
Found a way to do this: Inser this into your Model Class and customize to suit your logic.
public function companies(){
$instance = Community::of($this->community); //create instance
$foreignKey = 'id';
$localKey = 'foreign_id';
$tableName = $instance->getTable(); //or any logic of yours
//Here you can dynamically choose the table name, taken from the "HasRelationships.php" File of Laravel
return $this->newHasMany(
$instance->newQuery(), $this, $tableName.'.'.$foreignKey, $localKey
);
}