Skip to content

Instantly share code, notes, and snippets.

@tzkmx
Created April 17, 2020 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzkmx/88daa0ddce94327fe86aa4640c80e29c to your computer and use it in GitHub Desktop.
Save tzkmx/88daa0ddce94327fe86aa4640c80e29c to your computer and use it in GitHub Desktop.
Dynamic model table name
<?php
use Illuminate\Database\Eloquent\Model;
class Migration extends Model
{
public function getTable()
{
$ns = config('ns.ns');
return (empty($ns)
? ''
: $ns . '.') .
parent::getTable();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment