title: Insert Multiple Records At Once With Laravel
body: <p>I am inserting the data to the rows one by one, but I have heard somewhere that it requires much time if there are many data to insert. So what are the ways of inserting them all at once?</p>
  
  <pre><code>public function add(Request $request)
  {
      if ($request-&gt;ajax()) {
          $books = $request-&gt;books;
          foreach ($books as $book) {
              if (!empty($book)) {
                  $add = new Book;
                  $add-&gt;name = $book;
                  $add-&gt;user_id = Auth::user()-&gt;id;
                  $add-&gt;save();
              }
          }
      }
  }
  </code></pre>