Consider this Simple Scenario:
<?php
class SomeClass{
public static $a = 12;
public static $b = "some value";
public static $c = "another value";
public static function getSomeData(){
return self::$a . " " . self::$b . " " . self::$c;
}
}
$b = SomeClass::getSomeData();
//DUMPS '12 some value another value' TO THE OUTPUT STREAM...
var_dump($b);
$strClassName = "SomeClass";
//STILL DUMPS '12 some value another value' TO THE OUTPUT STREAM...
var_dump(call_user_func($strClassName. "::getSomeData"));
Extending this Knowledge to your Unique Case, You might want to do something like:
<?php
$table = Teller::select('*')->where('user_id','=', $this->user_id)->first();
$modelName = trim($table->tables,'"');
$implicitCall = call_user_func($modelName. "::select", '*');
$implicitCall = call_user_func($modelName. "::where", array('id', '=', $id));
$loan = call_user_func($modelName. "::get");
?>
Optionally; You may even take this a little further. Since we know that you are using Fluent Setters; it is clear that the First implicit call will return an instance of the Class so we could do something like so:
<?php
$table = Teller::select('*')->where('user_id','=', $this->user_id)->first();
$modelName = trim($table->tables,'"');
// THIS SHOULD RETURN AN INSTANCE OF THE CLASS IN QUESTION: THE MODEL CLASS
$implicitCall = call_user_func($modelName. "::select", '*');
// DO YOU DOUBT IT? WELL, DOUBT IS THE BEGINNING OF ALL KNOWLEDGE.
// I DOUBT IT TOO; SO LET'S CONFIRM OUR DOUBTS
var_dump($implicitCall); // EXPECTED TO DUMP THE CLASS IN QUESTION.
// NOW WE CAN JUST USE THE $implicitCall VARIABLE AS IF IT WAS AN INSTANCE OF THE MODEL CLASS LIKE SO:
$loan = $implicitCall->where('id','=', $id)->get();
?>
I hope this answers helps and works for you though... ;-)