Skip to content

Commit

Permalink
Implemented ODBCBuilder to set columns type
Browse files Browse the repository at this point in the history
  • Loading branch information
andreossido committed May 14, 2018
1 parent 9481fb0 commit bbaa2be
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/ODBCBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Created by PhpStorm.
* User: Andrea
* Date: 21/03/2018
* Time: 16:30
*/

namespace Abram\Odbc;

use App\BaseModel;
use Illuminate\Database\Query\Builder;

class ODBCBuilder extends Builder
{
/**
* @var BaseModel
*/
private $model;

public function __construct($connection,
$grammar = null,
$processor = null,
$model = null)
{
$this->model = $model;
return parent::__construct($connection, $grammar, $processor);
}

public function whereIn($column, $values, $boolean = 'and', $not = false)
{
return parent::whereIn($column, $values, $boolean, $not);
}


public function where($column, $operator = null, $value = null, $boolean = 'and')
{
list($value, $operator) = $this->prepareValueAndOperator(
$value, $operator, func_num_args() == 2
);
$value = $this->getModel()->wrapAttribute($column, $value);
return parent::where($column, $operator, $value, $boolean);
}

/**
* @return BaseModel
*/
public function getModel(): BaseModel
{
return $this->model;
}

/**
* @param BaseModel $model
*/
public function setModel(BaseModel $model): void
{
$this->model = $model;
}
}

0 comments on commit bbaa2be

Please sign in to comment.