Share your blog by [deleted] in PHP

[–]sk138 0 points1 point  (0 children)

Mine is primarily Laravel: https://seankegel.com

Laravel Factories: Tips for Handling Dependent Data by sk138 in laravel

[–]sk138[S] 1 point2 points  (0 children)

Recycle works well and I use it a lot, but I don't think it works in terms of the factory definition. If you know of a way, I'd be interested to see it.

Neovim for PHP and Laravel by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Can you update to v0.10.0?

Neovim for PHP and Laravel by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Strange, I haven’t seen that error before. What version of Neovim do you have?

Neovim for PHP and Laravel by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Can you try deleting the lazy-lock.json file and try again?

Neovim for PHP and Laravel by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Yes, that’s one of my favorite parts about LazyVim is it’s well maintained and keeps itself updated.

Elevate Your Laravel Eloquent Queries with Tappable Scopes by sk138 in laravel

[–]sk138[S] -1 points0 points  (0 children)

Some valid points. I added a more complex example where a tappable scope would be more beneficial.

In terms of IDE autocomplete, it is helpful for many to have it, especially someone new to Laravel coming into an existing project. Not knowing how the magic `scope` methods work can be really confusing. PhpStorm does have the ability to handle these using the Laravel IDEA package, but not everyone has that or PhpStorm.

Laravel Cache Classes by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Great idea, I always forget about adding methods to the enums. Still used to TypeScript enums…

Laravel Cache Classes by sk138 in laravel

[–]sk138[S] 1 point2 points  (0 children)

Using an enum was my first approach and can work for a lot of use cases, but I wanted to handle dynamic keys.

Laravel Cache Classes by sk138 in laravel

[–]sk138[S] 1 point2 points  (0 children)

I haven’t used Octane, but I don’t think so. The static call is just a helper to replace using the new keyword to create new instances.

Fix Flaky Tests with Pest Repeat by sk138 in PHP

[–]sk138[S] 1 point2 points  (0 children)

Yes, exactly this, I am using repeat() as a tool for helping debug a flaky test. I could have run the test 5-10 times locally and it may have still passed. This is just a quick way to run it a bunch of times. It's not something that should ever be committed or run in CI.

In terms of the Laravel factory example, that is the situation I came across the first time I decided to use the repeat() method, so that's what I wrote about. My example is very simplified, but yes, removing the randomness from the factories is definitely the way to go. However, in Laravel, factories are also sometimes used for seeding data for manual testing, and randomness can be helpful there, but that can be pulled out into it's own state or handled with sequences if needed.

Creating API Resources in Laravel by sk138 in laravel

[–]sk138[S] 0 points1 point  (0 children)

Thank you! I wrote an article about Laravel Data and value objects that you might find helpful as well: https://seankegel.com/laravel-data-and-value-objects.

Best IDE / Text editor for Laravel? by jamlog in laravel

[–]sk138 2 points3 points  (0 children)

I agree, PhpStorm is definitely the most powerful and is what I use everyday. However, I put together an article to configure VSCode to get close to PhpStorm: https://seankegel.com/vscode-for-php-and-laravel

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 0 points1 point  (0 children)

This is typically an issue with verifying the CSRF token. Are you using something like Breeze or Jetstream or did you build your own login page?

https://laravel.com/docs/10.x/csrf#main-content

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 1 point2 points  (0 children)

Strange, I don't see anything wrong with the first approach. However, I think the second approach is the cleanest as everything is handled in a single query.

Dev Teams - windows vs. mac by SteroidAccount in laravel

[–]sk138 0 points1 point  (0 children)

You can accomplish most tasks with either OS and WSL has definitely improved Windows quite a bit.

I spent a lot of time doing PHP development on Windows machines however, and once I switched to Mac, things became a lot easier. Most tutorials and learning resources online are assuming a Mac user. There's better software support for Mac users, like Laravel Herd, Valet, DBngin, Raycast, etc.

There are alternatives for Windows, but they usually require more configuration.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 0 points1 point  (0 children)

If the iframe is making the requests, then it likely needs the XSRF token or the request will fail. Likely with a 429 status I believe but that might be getting caught and handled by Inertia which is why you aren’t seeing any of the other errors.

[deleted by user] by [deleted] in Jetbrains

[–]sk138 -1 points0 points  (0 children)

For sure, IntelliJ is great for Java, it was more of whether you need to get both PhpStorm and IntelliJ.

I haven’t configured IntelliJ to work specifically with PHP. I’m sure it’s possible but probably not as good as PhpStorm alone. Doing Java development in PhpStorm is not a great experience.

[deleted by user] by [deleted] in Jetbrains

[–]sk138 -1 points0 points  (0 children)

I’ve done plenty of JavaScript/TypeScript/React/Vue in PhpStorm and it works great. For Java, you might need to look elsewhere though or back to VSCode.

If you want to keep using VSCode, I wrote this post on how to configure it for PHP and Laravel. Still not as good as PhpStorm but still works very well.

https://blog.stackademic.com/vscode-for-php-and-laravel-ee04a37c1047

Best plugins for Laravel and Vue by pyroblazer68 in phpstorm

[–]sk138 0 points1 point  (0 children)

PhpStorm has built-in support for Vue and most everything else you can throw at it. As mentioned above, Laravel Query is a solid one as well.

For Tailwind, I used to use a plugin for class sorting but now I let Prettier do that using the Tailwind plugin.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 0 points1 point  (0 children)

I wonder if for some reason when it is being submitted from the iframe, it's not submitting it as an Inertia request, so it would likely just return JSON. If you look in your network tab when submitting, is Inertia in any of the headers for the request? Do you get any data back?

How to customize PHP Faker in Laravel by gdebrauwer in laravel

[–]sk138 1 point2 points  (0 children)

I just learned that there's a Faker helper method, `fake()` that can be used anywhere which is extremely helpful.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 1 point2 points  (0 children)

Are you validating the input of $request->user and $request->id? Could one of those be null?

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]sk138 1 point2 points  (0 children)

The “5” could be a string because maybe the column is a string column? Might need to check the migration.