Bulk Insertion in Laravel using eloquent ORM

How can we perform bulk database insertions in Laravel using Eloquent ORM? I am working with an XML document, looping through its elements. I want to accomplish something like this in Laravel: $sXML = download_page(‘http://remotepage.php&function=getItems&count=100&page=1’); $oXML = new SimpleXMLElement($sXML); $query = “INSERT INTO tbl_item (first_name, last_name, date_added) VALUES”; foreach($oXML->results->item->item as $oEntry){ $query .= “(‘” . … 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

Laravel PHP Command Not Found

I have installed Laravel using composer without problems, but when I try to execute “laravel” in my terminal I have this typical error: -bash: laravel: command not found If I read the documentation of the official site I need to do that: Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel … Read more

Laravel Unknown Column ‘updated_at’

I’ve just started with Laravel and I get the following error: Unknown column ‘updated_at’ insert into gebruikers (naam, wachtwoord, updated_at, created_at) I know the error is from the timestamp column when you migrate a table but I’m not using the updated_at field. I used to use it when I followed the Laravel tutorial but now … Read more