πŸ’‘ Two Lesser-Known Laravel Tricks: numerify & invisible

Published: (December 11, 2025 at 05:18 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

numerify in Eloquent Factories

The numerify method from Faker lets you replace # characters with random digits.

public function definition(): array
{
    return [
        'phone' => $this->faker->numerify('+##'), // Example output: +20
    ];
}

invisible in Migrations

The invisible column modifier hides a column from default SELECT queries while keeping it in the database.

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::create('users', function (Blueprint $table) {
    $table->timestamp('email_verified_at')
          ->nullable()
          ->invisible();
});

Find more tips and share your knowledge here:
https://github.com/digging-code-blog

Back to Blog

Related posts

Read more Β»