CREATE TABLE test (
`id` int NOT NULL AUTO_INCREMENT,
`data` JSON,
PRIMARY KEY (`id`)
);
INSERT INTO test (data) VALUES ('[["1411","603006669"],["111","111"]]');
select * from test;
public function bindValue(Cell $cell, $value)
{
// проверяем у cell нужная ли нам это колонка-ячейка нужное ли значение и через $cell->getStyle шарашим свой стиль
}
public function user()
{
$instance = $this->newRelatedInstance(User::class);
$foreignKey = `request_discussions`.`request_id`;
$localKey = $this->getKeyName();
return $this->newHasOne($instance->newQuery(), $this, $foreignKey, $localKey)->join('orders.requests', 'requests.user_id', '=', 'users.id');
}
echo number_format(1.65/0.55, 30);
//или лучше так
debug_zval_dump(1.65/0.55);
SELECT
s.*,
CONCAT(u.name, ' ', s.house_number) as address
FROM
users u
LEFT JOIN streets s ON s.id = u.street_id
WHERE u.full_name LIKE '%на%'
OR CONCAT(u.name, ' ', s.house_number) LIKE '%на%'
LIMIT 0, 10
public function scopeOfSearch(Builder $query, $search){
return $query->leftjoin('streets', 'streets.id', '=', 'users.street_id')->where(function($builder) use($search){
return $query->whereRaw('CONCAT(u.name, ' ', s.house_number) like ?', '%'.$search.'%')->orWhere('users.full_name', 'like', '%'.$search.'%');
});
}
$users = User::ofSearch($search)->paginate(10);
WITH
balance(userid, date, balance_amount) AS (
VALUES ('1112879', DATE '2022-08-05',700),
('1112879', DATE '2022-08-15',1500),
('1112879', DATE '2022-08-18',10100),
('1112879', DATE '2022-08-22',1700),
('1112879', DATE '2022-09-01',4200)
)
select
day::date,
(select balance_amount from balance as t where t.userid = balance.userid and (day::date - t.date::date)>=0 ORDER BY abs(day::date - t.date::date) asc limit 1) as amount,
balance.userid
from
generate_series('2022-08-01'::date, now()::date, '1 day'::interval) as day
cross join (select userid from balance group by userid) as balance
ORDER BY day;