Remember this artisan command when you create a new table

Search for a command to run...

No comments yet. Be the first to comment.
All the tricks that I know and share to you guys, hopefully they would make your life easier
Hey guys, Today I'll share with you how to set up Gmail as the Email Client for your domain, and of course, it is totally FREE 😎. We all know that when releasing a new product, especially if you're on the "solo" path, minimal cost would definitely h...
Hey guys, An update after I posted the “Laravel Excel: How to append rows to an existing Excel file“ a while back. This post will give you another solution and probably a better way to export that fits every case. Problems Previously, when trying to ...

Hey guys, An easy topic for today! Make something a default (e.g., category, product, campaign, etc). Let’s go with the categories table for the examples. Let’s say we only want one category to be the default one. And find out which is the optimal wa...
Hey guys, Probably a chapter 2 of this https://sethphat.dev/why-is-wordpress-still-an-awesome-cms blog post, haha. Here was the story: I’ve been spending like 2 days figuring out which CMS I want to use for my new blog (for my new hobby lol) Let’s se...

Hey guys, Well damn, it has been a while since my last post lol, lazy & busy. But here I am, back to write useful tips for y’all 🥹 Let us do some exporting tasks for today, using Laravel Excel to export XLSX (yeah CSV is so 2010 lol). But, append mo...

Hey guys, Recently, I just bought Herd PRO (a yearly subscription). I’ve been using the basic Herd since the first release. So, my latest work required interaction with S3 storage, there are several ways to achieve that in the local env: Use Cloud (...

Hey guys,
This command has been presented there for a while but I want to share it again 🥹
Before I usually do:
php artisan make:migration CreateAbcTables
php artisan make:model Abc
php artisan make:factory Abc
...
It's quite a hassle, isn't it? But actually, there is a way to do it in 1 go 😎
php artisan make:model Article --migration --factory
Once hitting this one, it will create for us:
Article model
Migration (with Schema::create('articles', ...)), automatically do the "pluralize".
Article Factory (optional - if you want to write tests)
--controller
--resource
--policy
--seed
--all: this will create everything 😆
IMO, I do think that model, migration & factory are good enough for the first go. We can create a controller or policy or else in later 🤗.
When creating a migration to change the schema of an existing table, try put the name like this:
AddUserIdColumnToUsersTable
ChangeAmountTypeInTransactionsTable
DeleteUserIdFromEventsTable
Laravel will extract the middle part, transform the table into the snack_case, and prepare the base code for us
Schema::table('{your_table}', ...);
Save a bit of your time, eh? 🥹
Thank you for reading this, I believe many of us already know & aware of these options. Save time and jump into productivity quicker.
Laravel is so beautiful 😍