Laravel-5 ‘LIKE’ equivalent (Eloquent)

I’m using the below code to pull some results from the database with Laravel 5. BookingDates::where(’email’, Input::get(’email’))->orWhere(‘name’, ‘like’, Input::get(‘name’))->get() However, the orWhereLike doesn’t seem to be matching any results. What does that code produce in terms of MySQL statements? I’m trying to achieve something like the following: select * from booking_dates where email=”[email protected]” or name … Read more

How to query between two dates using Laravel and Eloquent?

I’m trying to create a report page that shows reports from a specific date to a specific date. Here’s my current code: $now = date(‘Y-m-d’); $reservations = Reservation::where(‘reservation_from’, $now)->get(); What this does in plain SQL is select * from table where reservation_from = $now. I have this query here but I don’t know how to … Read more

How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

I would like to make a timestamp column with a default value of CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP using the Laravel Schema Builder/Migrations. I have gone through the Laravel documentation several times, and I don’t see how I can make that the default for a timestamp column. The timestamps() function makes the defaults 0000-00-00 00:00 for … Read more