I would like to extend the Query Builder so i have my own raw Query builder class, that i can filter down.
I tryd to do it like this:
namespace App\Query;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Query\Processors\Processor;
class Contract extends Builder
{
public function __construct(ConnectionInterface $connection, Grammar $grammar = null, Processor $processor = null)
{
parent::__construct($connection, $grammar, $processor);
$this->from('tbl_prm_contract');
}
}
Then in my controller:
public function getAll(ContractFilter $filter ,\App\Query\Contract $contract)
{
error_log($contract->where('prm_partner_id' , '=', 1)->toSql());
error_log($contract->where('prm_partner_id' , '=', 1)->get());
}
if i return the query i get this:
select * from "tbl_prm_contract" where "prm_partner_id" = ?
this is fine the table and field is correct. Problem is when i try to get the data and execute the query it fails with the error: Table or view notfound.
"message": "Error Code : 942\nError Message : ORA-00942: Tabelle oder View nicht vorhanden\nPosition : 14\nStatement : select * from \"tbl_prm_contract\" where \"prm_partner_id\" = :p0 and \"prm_partner_id\" = :p1\nBindings : [1,1]\n (SQL: select * from \"tbl_prm_contract\" where \"prm_partner_id\" = 1 and \"prm_partner_id\" = 1)"
Any one got an idea?