Looking for a way to get specific columns from Laravel Eloquent with custom column names.
E.g. get example_name as name.
I am trying to replicate SQL Alias like SELECT column_name AS alias_name
but without using custom attributes.
Here is and example query in Laravel:
Table::get(['column1', 'column2', 'column3'])->all()
And what I would like it to get would look something like this:
Table::get(['column1', 'column2 AS column4', 'column3'])->all()