Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Ok, I figured this one out.

I realize there' s a getTable() method in the Model class.

  public function __construct()
 {
    $prefix = Config::get('database.connections.mysql.prefix');
    $this->setTable( $prefix.$this->table );
 }
Last updated 9 years ago.
0

That works, but isn´t the best way to do this. Just use Laravels function ;)

DB::getTablePrefix();
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

webtest01 webtest01 Joined 11 Oct 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.