when I define table name in laravel model like
class Test extends Model
{
use SoftDeletes;
protected $table="en_test";
and write in my code
DB::enableQueryLog();
Test::get();
dd(DB::getQueryLog());
I have under result
"query" => "select * from `en_test` where `en_test`.`deleted_at` is null"
"bindings" => []
"time" => 0.88
But when I set table name like protected $table;
class Test extends Model
{
use SoftDeletes;
public function __construct()
{
$locale =\App::getLocale();
$this->table=$locale."_test";
}
and write previous code. I have
"query" => "select * from `en_test`"
"bindings" => []
"time" => 0.93
Why where
fa_test.
deleted_atis null
deleted from my query?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire