---
title: "Laravel Pro Tip"
url: https://daily.dev/posts/laravel-pro-tip-syyjcfzou
source_url: https://daily.dev/posts/laravel-pro-tip-syyjcfzou
type: freeform
source: "Lonely Programmer"
author: "Thodoris Kouleris"
published: 2026-01-07T14:23:29.583Z
updated: 2026-01-07T14:23:43.666Z
tags: ["database", "sql", "php", "laravel"]
reading_time: 1
upvotes: 29
comments: 2
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel Pro Tip

**[Lonely Programmer](https://daily.dev/sources/lonely_programmer)** · [@tkouleris](https://daily.dev/tkouleris) · 1 min read · 29 upvotes · 2 comments

## Summary

Instead of manually converting SQL insert statements into Laravel seeder syntax, you can load SQL files directly using `file_get_contents()` and execute them with `DB::unprepared()`. This approach saves time when seeding databases with existing SQL data.

## Content

Pro tip. 🥵
Tired of rewriting SQL insert statements as Laravel seeders? 🤔
Load your SQL file directly in the seeder with `file_get_contents()` and execute it using `DB::unprepared()`. 💪

![611991726_764884939964795_5738113142201177498_n](https://media.daily.dev/image/upload/s--3X9SsYcU--/f_auto/v1767795742/ugc/content_84b64809-da1d-4d89-aa03-b0c3bcd78f41?_a=BAMAMiZW0)

Source: [MrPunyapal](https://www.facebook.com/MrPunyapal)

## Community discussion

Top comments from developers on daily.dev.

**@natedata** · 2 upvotes

> Clean pattern.

**@hdnelson2024** · 1 upvotes

> Excelentes consejos colega, gracias

## Similar posts on daily.dev

- [Seeding The Database](https://daily.dev/posts/seeding-the-database-qzb15geu9) · Larablog · 0 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#sql](https://daily.dev/tags/sql), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel)

[View this post on daily.dev](https://daily.dev/posts/laravel-pro-tip-syyjcfzou)
