<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sanz</title>
    <description>The latest articles on Forem by Sanz (@sanz).</description>
    <link>https://forem.com/sanz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F416008%2F66ee6b88-3960-4f32-86ad-6db47d01c092.jpg</url>
      <title>Forem: Sanz</title>
      <link>https://forem.com/sanz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sanz"/>
    <language>en</language>
    <item>
      <title>Useful Laravel Blade Directives</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Fri, 07 Aug 2020 03:52:13 +0000</pubDate>
      <link>https://forem.com/sanz/useful-laravel-blade-directives-3gd2</link>
      <guid>https://forem.com/sanz/useful-laravel-blade-directives-3gd2</guid>
      <description>&lt;p&gt;Laravel Blade Directives are syntactic sugar functions that hide the underlying complex and ugly code. This make code more readable and clear.&lt;/p&gt;

&lt;p&gt;Blade includes lots of built-in directives. But, this tutorial will help you with laravel blade directives that you’ll often reach out during your time in laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Check whether the user is a guest or not using blade directive
&lt;/h2&gt;

&lt;p&gt;This helps to check if the user is a guest i.e., not an authenticated user. For this purpose we use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@if(auth()-&amp;gt;guest())
    // The user is not authenticated.
@endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make this even easier, the blade provides us with &lt;a class="mentioned-user" href="https://dev.to/guest"&gt;@guest&lt;/a&gt; a directive. This helps to write code in a much shorter way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@guest
    // The user is not authenticated.
@endguest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Check if the user is authenticated or not using blade directive
&lt;/h2&gt;

&lt;p&gt;To check this, we can use the code given below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@if(auth()-&amp;gt;user())
    // The user is authenticated.
@endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code works fine but as a programmer, we should always look for easy and shorter ways to write code. For that purpose, laravel provides blade directive which is &lt;a class="mentioned-user" href="https://dev.to/auth"&gt;@auth&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@auth
    // The user is authenticated.
@endauth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To combine the two directives we can use else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@guest
    // The user is not authenticated.
@else
    // The user is authenticated.
@endguest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Include first view if it exists else include second view
&lt;/h2&gt;

&lt;p&gt;Most of the websites nowadays have multiple themes. This might require us to include a file if it exists else include another file. We can easily achieve this by using laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@if(view()-&amp;gt;exists('first-view-name'))
    @include('first-view-name')
@else
    @include('second-view-name')
@endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can write the above code in much easier and shorter way with blade.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@includeFirst(['first-view-name', 'second-view-name']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can continue this post on &lt;a href="https://laravelproject.com/useful-laravel-blade-directives/"&gt;https://laravelproject.com/useful-laravel-blade-directives/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Different Ways to Redirect User</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Tue, 28 Jul 2020 09:23:12 +0000</pubDate>
      <link>https://forem.com/sanz/different-ways-to-redirect-user-ba7</link>
      <guid>https://forem.com/sanz/different-ways-to-redirect-user-ba7</guid>
      <description>&lt;p&gt;redirect() is one of the most used and popular helper function. This function redirects users to different URLs of the website. By using this method, we can redirect the user to pages with or without data.&lt;br&gt;
Redirect to different URL&lt;/p&gt;

&lt;p&gt;This is the most and simplest form in which the redirect method is used. We can redirect a user to the homepage by simply using the method below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect('/');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Users can also pass parameters inside the redirect method. The parameters given in the method will be added to the URL of the base application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect('contact');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Likewise, users can also pass more parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect('user/profile');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  back() in Laravel
&lt;/h2&gt;

&lt;p&gt;If the user wants to perform some sort of tasks and redirect back to the same page then the user can use back(). This method is also really helpful.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect()-&amp;gt;back();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Redirect to Route
&lt;/h2&gt;

&lt;p&gt;Users can also name the routes in the application for consistency. Some users call named routes instead of using URLs. Let’s see an example to make this concept clear.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect()-&amp;gt;route('profile.index');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also pass the second parameter in route() in the form of an array. Let's see an example of a parameterized route.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('post/{id}', 'PostController@edit')-name('post.edit');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can write the above above in simpler form which is here below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return redirect()-&amp;gt;route('post.edit', ['id' =&amp;gt; $post-&amp;gt;id]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the details of the post in &lt;a href="https://laravelproject.com/different-ways-to-redirect-user/"&gt;https://laravelproject.com/different-ways-to-redirect-user/&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>webdev</category>
      <category>php</category>
    </item>
    <item>
      <title>How to Improve Routing In Laravel</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Fri, 24 Jul 2020 04:17:05 +0000</pubDate>
      <link>https://forem.com/sanz/https-laravelproject-com-how-to-improve-routing-in-laravel-45h9</link>
      <guid>https://forem.com/sanz/https-laravelproject-com-how-to-improve-routing-in-laravel-45h9</guid>
      <description>&lt;p&gt;Routing allows the user to route application requests to its appropriate controller. Laravel has inbuilt API which is really helpful and time saving. Hence, it is important for newcomers to know and extend their knowledge about routing.&lt;/p&gt;

&lt;p&gt;Users can learn about routing technique basics from here. Please go through the link to get more familiar with routing.&lt;/p&gt;

&lt;p&gt;Here are a few tricks that can help you to use routing in Laravel:&lt;br&gt;
Using Custom Namespace&lt;/p&gt;

&lt;p&gt;Users can define namespace for a group of routes using fluent routing API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::namespace('Admin')-&amp;gt;group(function () {
    // Controllers Within The "App\Http\Controllers\Admin" Namespace
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command given below to create controller in App\Http\Controllers\Admin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:controller -r Admin/UsersController
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the command, routes/web.php will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::namespace('Admin')
    -&amp;gt;prefix('admin')
    -&amp;gt;group(function () {
        Route::resource('users', 'UsersController');
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Debug Routes&lt;/p&gt;

&lt;p&gt;To find or debug all defined routes, users can run php artisan route:list . Basically what this command does is that it helps to see name of all routes and attached middleware to the route.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan route:list
+--------+----------+----------+------+---------+--------------+
| Domain | Method   | URI      | Name | Action  | Middleware   |
+--------+----------+----------+------+---------+--------------+
|        | GET|HEAD | /        |      | Closure | web          |
|        | GET|HEAD | api/user |      | Closure | api,auth:api |
+--------+----------+----------+------+---------+--------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are interested, you can continue this post on &lt;a href="https://laravelproject.com/how-to-improve-routing-in-laravel/"&gt;https://laravelproject.com/how-to-improve-routing-in-laravel/&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>webdev</category>
      <category>php</category>
    </item>
    <item>
      <title>10 Laravel 7 Eloquent Tricks</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Sat, 18 Jul 2020 11:29:15 +0000</pubDate>
      <link>https://forem.com/sanz/10-laravel-7-eloquent-tricks-29o</link>
      <guid>https://forem.com/sanz/10-laravel-7-eloquent-tricks-29o</guid>
      <description>&lt;p&gt;Laravel Eloquent ORM provides a whole lot of useful functionality which allows you to work with your database tables and relationships using an eloquent expressive syntax.&lt;/p&gt;

&lt;p&gt;So, In here are some of the features which you might often reach out for ease of use and cleaner code in your laravel project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding first record or records
&lt;/h2&gt;

&lt;p&gt;Here’s an example of finding a post with id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Instead of this
$post = Post::find($id);

if(!$post) {
   abort(404);
}

// Do this
$post = Post::findOrFail($id);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, you can even find multiple records at once by passing array of ids as second argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$posts = Post::find([1,2,3]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even specify id with the fields to select as the second argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$post = Post::find(1, ['title', 'description']);
$post = Post::findOrFail(1, ['title', 'description']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Model booted() method
&lt;/h2&gt;

&lt;p&gt;In this method, you can specify what to do on different model events such as creating, updating, deleting etc by passing a closure function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User extends Model
{
    public static function booted()
    {
        static::creating(function ($user) {
            // delete comments
            // delete images
        });

        static::updating(function ($post) {
            // update comments
            // update images
        });
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Change default model properties
&lt;/h2&gt;

&lt;p&gt;These are only few of the default properties of an eloquent model you often would reach out. You can change the values according to your needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Post extends Model
{
    // The table associated with the model.
    protected $table = 'posts';

    // fields that can be filled using mass assignment Post::create()
    protected $fillables = ['title' , 'description'];

    // Eager load relations everytime you fetch posts
    protected $with = ['comments'];

    // appends accessors to the model's array form.
    protected $appends = ['formatted_date', 'short_title'];

    // The primary key associated with the table.
    protected $primaryKey = 'post_id';

    // Indicates if the IDs are auto-incrementing.
    public $incrementing = false;

    // Indicates if the model should be timestamped.
    public $timestamps = false;

    // The storage format of the model's date columns.
    protected $dateFormat = 'U';

    // change the names of the columns used to store the timestamps
    const CREATED_AT = 'creation_date';
    const UPDATED_AT = 'last_update';
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Counting Related Models
&lt;/h2&gt;

&lt;p&gt;you can retrieve the number of results from a relationship without actually loading them you may use the withCount method.&lt;/p&gt;

&lt;p&gt;Define a relation comments():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function comments() 
{
    return $this-&amp;gt;hasMany(Comment::class);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you can use like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$posts = Post::withCount('comments')-&amp;gt;get();

foreach ($posts as $post) {
    echo $post-&amp;gt;comments_count;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you find this useful, you can continue on &lt;a href="https://laravelproject.com/10-laravel-7-eloquent-tricks/"&gt;https://laravelproject.com/10-laravel-7-eloquent-tricks/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Laravel Timestamp Tricks</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Tue, 07 Jul 2020 13:49:39 +0000</pubDate>
      <link>https://forem.com/sanz/laravel-timestamp-tricks-37n</link>
      <guid>https://forem.com/sanz/laravel-timestamp-tricks-37n</guid>
      <description>&lt;p&gt;There are various interesting things that a user can do with laravel timestamp. Some of which are:&lt;/p&gt;

&lt;p&gt;Change Timestamp Column Name&lt;/p&gt;

&lt;p&gt;If the user has non-laravel database as well as differently named timestamp column then there is no need to panic.&lt;/p&gt;

&lt;p&gt;Lets say user has created_time and updated_time in timestamp column. User can specify it in model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Role&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="no"&gt;CREATED_AT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'created_time'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="no"&gt;UPDATED_AT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'updated_time'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable Timestamps&lt;/p&gt;

&lt;p&gt;If user doesn’t have time column but tries something like Model::create($arrayOfValues). As a result, he/she will get a SQL error.&lt;/p&gt;

&lt;p&gt;For solving this problem, user can disable automatic timestamp by adding one property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Role&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nv"&gt;$timestamps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;FALSE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before Laravel7, the datetime would be in format of 2019-12-02 20:01:00. However now in laravel7, date time is in format of 2019-12-02T20:01:00.283041Z. &lt;/p&gt;

&lt;p&gt;So, if you need to customize timestamp format, set the $dateFormat property on your model which determines how attributes are stored in database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Flight&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cd"&gt;/**
     * The storage format of the model's date columns.
     *
     * @var string
     */&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$dateFormat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'U'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Order Timestamp latest and oldest&lt;/p&gt;

&lt;p&gt;User can order data by timestamp using two shortcut methods which are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is for getting latest time. As for getting oldest timestamp, the code is;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;oldest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;If you are interested, there are a lot more of these in &lt;a href="https://laravelproject.com/laravel-timestamp-tricks/"&gt;https://laravelproject.com/laravel-timestamp-tricks/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>webdev</category>
      <category>php</category>
    </item>
    <item>
      <title>Quicker Way to Seed Records in Laravel</title>
      <dc:creator>Sanz</dc:creator>
      <pubDate>Thu, 25 Jun 2020 09:03:12 +0000</pubDate>
      <link>https://forem.com/sanz/quicker-way-to-seed-records-in-laravel-47gg</link>
      <guid>https://forem.com/sanz/quicker-way-to-seed-records-in-laravel-47gg</guid>
      <description>&lt;p&gt;Sometimes, there might be a situation where you need to insert a lot of test data into the database. Usually for testing purposes and performance in laravel.&lt;/p&gt;

&lt;p&gt;However, seeding huge amount of records can take exceptionally long time and is not ideal when you’re in a state where you have to frequently seed database.&lt;/p&gt;

&lt;p&gt;So, let’s try to improve the seeding time so that we won’t have a hard time waiting for it to finish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://laravelproject.com/optimize-database-seeder-in-laravel-for-faster-seeding/"&gt;https://laravelproject.com/optimize-database-seeder-in-laravel-for-faster-seeding/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>webdev</category>
      <category>database</category>
    </item>
  </channel>
</rss>
