You can make a scope that switches the "from" part of the query builder
public function scopeFromTable($query, $tableName)
{
$query->from($tableName);
}
$extracts = PostalcodeExtract::fromTable($tableName)->all();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community