S
S
soulness2016-02-05 05:14:59
Laravel
soulness, 2016-02-05 05:14:59

How to add extra field to select using ORM?

Laravel 4.2.17
I want to add an additional field 'min(price) as price' when searching records through ORM. Creating a search:
Apartment::active();
Tried like this:

Apartment::active()->addSelect('min(price) as price');

So:
Apartment::active()->SelectRaw('min(price) as price');

And I get this error:
Error in exception handler: Serialization of 'Closure' is not allowed in ~\vendor\monolog\monolog\src\Monolog\Logger.php:0
Tell me how to add a new field correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question