martinbean wrote a reply+100 XP
14h ago
@phpmick You should be in control of any and all code making its way into your codebase, whether that’s written by you, a colleague, or an LLM. Here are some tips and guidelines I follow when doing AI-assisted development:
- Give agents very discreet tasks to complete.
- When you’re prompting the agent, ask it to ask you about anything it’s unsure of instead of guessing. You’ll find you’ll get something far more in line with what you had in mind and were expecting, instead of giving an agent a loose description, and it making assumptions and making something that’s maybe 60% of what you wanted.
- Give agents way to verify the work they’re producing. There should be a goal, as well as instructions on how to run any tool such as linting and testing tools. If linting/tests fail, the agent should go back and fix what’s broken before asking for your attention.
- Agents should also be given guardrails to avoid getting stuck in a loop and burning tokens.
- You should only be merging code you actually understand. If you don’t, review the agent output log. If you’re still unsure, then ask the agent to explain what it’s produced. As with human-produced code, less code is easier to grok than lots of code. Don’t have your agent spew out 50,000 lines of code and then review.
martinbean wrote a reply+100 XP
1d ago
@shivamyadav Stream the video how? Via S3?
martinbean wrote a reply+100 XP
3d ago
@shivamyadav Never heard of “UIshare” but you shouldn’t be serving static video files (i.e. MP4s) if this is content you want to control access to.
I’d add another recommendation for something like Mux as well. They will probably deliver video as HLS streams, require the use of signed URLs for playback, and you can even add DRM if you want to go down that route.
I’ve ran a video on demand platform for over 10 years now. I used to use Amazon for storing, transcoding, and delivering video; but moved to Mux maybe three years ago now and it’s far cheaper and easy to integrate. It’s to video what Stripe is to payments.
martinbean wrote a reply+100 XP
4d ago
@gp10devhts No. Printing is a client-side concern.
It would be a huge security issue if a PHP app hosted on some random server somewhere in the world could see what devices (including printers) were on your network.
martinbean wrote a reply+100 XP
5d ago
@kn_swe Can you post the full error message?
martinbean was awarded Best Answer+1000 XP
6d ago
@randy_johnson There’s no magic fix. If you just let AI go wild and just approve everything it does then yeah, your codebase is going to become unmanageable and full of slop. So you need to be specific in your directions and more meticulous on what AI-authored changes you allow into your codebase.
martinbean wrote a reply+100 XP
1w ago
@ismaelaek Don’t know why you want to make your life easier by not using the SDK provided by Meta/Facebook. If that’s the case, then you’ll need to read the API reference and implement the HTTP requests (and everything around it such as authorisation and response handling) yourself from scratch.
martinbean wrote a reply+100 XP
1w ago
@shivamyadav This sounds like something you’d be able to do with server logs. But, as with most of your questions, my question is: why? Are you really going to be billing users for say, downloading style sheets? 😕
martinbean wrote a reply+100 XP
1w ago
@randy_johnson There’s no magic fix. If you just let AI go wild and just approve everything it does then yeah, your codebase is going to become unmanageable and full of slop. So you need to be specific in your directions and more meticulous on what AI-authored changes you allow into your codebase.
martinbean wrote a reply+100 XP
1w ago
@puzbie The two things to look out for will be:
- The skeleton directory structure changed slightly from (I think) Laravel 11. The bootstrapping process was made a bit slimmer.
- Years later, Laravel still can’t decide how new projects should be created and Jetstream became deprecated in favour of “starter kits”. But looking at Jetstream’s composer.json file, it seems to be compatible with Laravel 13, so you should still be able to install it.
martinbean liked a comment+100 XP
1w ago
Error text?..
Are you sure Eloquent in migrations is good? Migrations are about raw database tables/columns, Eloquent is about models which are "next level" compared to DB calls. Sometimes they align, sometimes not. You cannot guarantee your migrations chain is consistent and always replayed with this approach.
I believe you need something like this: https://github.com/TimoKoerber/laravel-one-time-operations
It's like migrations for data, not structure.
martinbean wrote a reply+100 XP
1w ago
You prefer using simple navigation links ?
@vincent15000 Yes. And I dare say a lot of your users would say the same.
martinbean wrote a reply+100 XP
2w ago
@vincent15000 This is exactly why I don’t like (or implement) “infinite” scroll. It’s a pain in the ass for users.
martinbean wrote a reply+100 XP
2w ago
@joahi93 You signed up, just to reply to a 2-year-old thread…?
martinbean wrote a reply+100 XP
2w ago
Then when being processed by the job the 'status' field would get updated. Of course this is something the job shouldn't care about, so I thought well this is where a Contract/Interface would come in handy.
Is this a concept? Basically a Contract/Interface for Eloquent models.
@lsvagusa Yes. That’s the very definition of depend on interfaces, not implementations (the “L” in “SOLID”).
You would type-hint the interface in your job’s constructor, and then your job would call methods defined by that interface without knowing the actual class implementing that interface.
interface HasStatus
{
public function updateStatus(string $newStatus);
}
class UpdateStatusJob implements ShouldQueue
{
use Queueable;
public HasStatus $model;
public function __construct(HasStatus $model)
{
$this->model = $model;
}
public function handle(): void
{
$this->model->updateStatus('complete');
}
}
Your job now doesn’t care if it’s working with an Eloquent model, or if it’s working with an Eloquent model at all. Just so long as the class it receives implements the HasStatus interface.
martinbean wrote a reply+100 XP
2w ago
@jlrdw This question was over a decade old. That marriage has kids in middle school now! 😄
martinbean wrote a reply+100 XP
3w ago
@june92 Seriously, how many questions are you going to ask on this topic…?
You keep asking questions that if you do X, you will magically be a senior developer, or if you do Y, you will magically get a job. That’s not how the industry works.
martinbean wrote a reply+100 XP
3w ago
Shouldn't this at least deserve a 11.x patch?
@gravity_global No, because Laravel 11 stopped receiving security updates March 12th, 2026: https://laravel.com/docs/13.x/releases#support-policy
martinbean wrote a reply+100 XP
4w ago
@mikelmedina No. You shouldn’t be using helpers to “fix” bad code. You should just be eager-loading the relationships you actually need for a request.
martinbean wrote a reply+100 XP
4w ago
@june23 What do those “frameworks” have to do with an application? They’re just cloud providers. They have services that you would deploy and run code on. Yes, you can use. You can also create and host a web application without them.
Your question is basically: “Can I make a journey with these vehicles? Car, van, truck.”
You need to get out of this rut of, “if I use X then I will be a proper developer”. You should be using things when it makes sense to use them; not as a box-checking exercise.
martinbean wrote a reply+100 XP
1mo ago
@shivamyadav Which video? And why can’t you take inspiration from what you’ve seen? Why do you need the raw Figma file?
martinbean wrote a reply+100 XP
1mo ago
@gpapamichelakis Why? You should always be using the most recent version of software.
martinbean wrote a reply+100 XP
1mo ago
@digitalartisan So what about “engineers“ that have worked on projects where a load of money has been sunk into it, and the project’s then failed or just been canned? Such as Metaverse, Apple Car, Windows Phone, etc?
martinbean wrote a reply+100 XP
1mo ago
@shivamyadav No. That data lives in the browser. It’s client-side.
If any website could just automatically gobble browser session storage then that would be a massive security risk and attack vector.
You need to come up with a different method to achieve what you’re trying to achieve.
martinbean wrote a reply+100 XP
1mo ago
@june92 A developer will work on anything if you pay them enough to make it worth their while.
martinbean liked a comment+100 XP
1mo ago
I think it depends on their salary.
martinbean wrote a reply+100 XP
1mo ago
@randy_johnson You could also just dispense with it all and put everything in a single index.php script.
martinbean wrote a reply+100 XP
1mo ago
Thanks, ChatGPT.
martinbean wrote a reply+100 XP
1mo ago
@motinska94 Laracasts runs deals around Black Friday (November) each year. If you really want Laracasts access then I’d suggest saving and then purchasing when a subscription is heavily discounted.
martinbean wrote a reply+100 XP
1mo ago
@adamnet Are you actually going to reply? And say why you weren’t using source control when you’ve been told by multiple people to do so for months now…? Or will you just come back in a couple of months’ time with a yet another new post on how you’ve lost work and want to know how to get it back?
martinbean wrote a reply+100 XP
1mo ago
@earmsby 403 is a Forbidden response. So if the code works for one store but not another, it sounds like whatever credentials you’re trying to use does not have the permissions to actually view resources for that store. So the issue is going to be there; not with your code.
martinbean liked a comment+100 XP
1mo ago
martinbean wrote a reply+100 XP
1mo ago
Oh, you're right: thread.
@jussimannisto I seldom forget things I’ve read or seen. It’s a blessing and a curse 😅
martinbean liked a comment+100 XP
1mo ago
Jesus christ!
If that's your senior engineer writing that code today, they need to be sacked, ASAP!
That's not code written by a senior! They might have been there a long time, but they are not a senior engineer.
martinbean wrote a reply+100 XP
1mo ago
@adamnet This is what version control is for. And I’m sure you had been advised to use version control some time ago…?
martinbean wrote a reply+100 XP
1mo ago
@jaeggid That Laracasts series is a bit redundant now that Passkeys are natively supported by Laravel via a first-party package.
martinbean wrote a reply+100 XP
1mo ago
@eskiesirius This is literally the definition of premature optimisation…
martinbean wrote a reply+100 XP
1mo ago
Should I bite the nail and continue down this road since it will eventually lead to a better product
@randy_johnson “Better” according to who…?
Event-driven architecture is like any other paradigm: it can be implemented well and it can be implemented poorly. Just implementing an event-driven architecture won’t automatically and inherently make the end result “better”.
If this is an inventory system then all you need to do is record adjustments in a table. Insert a row each time you take stock, and each time stock leaves (i.e. is sold).
martinbean wrote a reply+100 XP
1mo ago
Given this behavior, I’m wondering if this could be related to the PPA Launchpad issue. Am I thinking in the right direction?
@khanareeb You need to profile requests instead of just guessing.
Profile a request and see where the most time is being spent. My guess is, if you have moved hosting, that you’re probably pointing to a remote database that’s connecting over the network instead of via a socket on the same machine, thus introducing latency. But again, just a guess. You need to profile to confirm the actual cause.
martinbean wrote a reply+100 XP
1mo ago
@imrandevbd You seem to have again replied to a thread just rewording exactly what I’ve written?
martinbean was awarded Best Answer+1000 XP
1mo ago
@shivamyadav I’ve worked on probably hundreds of Laravel projects over more than 10 years now, and at companies of all sizes (from SMEs to Fortune 500s). The projects that fell apart and became unmaintainable messes were the ones where developers decided to be “clever” and create their own folder structure, or do “modules”, “domains”, or whatever.
Seriously, stick to Laravel’s default directory structure:
- Put interfaces in an app/Contracts directory, which follows the framework’s convention.
- Use managers for things that can have multiple providers (i.e. payment gateways). Think how Laravel uses managers for components you interact with (cache, queue, etc) where the code doesn’t change if you swap providers (i.e. from Redis to database). Try to strive for the same in your application where you’re relying on interfaces and managers rather than a specific provider.
- If you have different “areas” in your application, then you can sub-namespace controllers (i.e.
App\Http\Controllers\Admin). - For interactions with third-party services, I create a dedicated namespace in an app/Services directory (i.e.
App\Services\Mux). I then treat this folder as a package, so it may have its own Artisan commands, Eloquent models, controllers, routes, etc with a service provider to register those resources.
It Just Works™ and scales, and your Artisan make:* commands still work without having to install horrible “glue” packages. And with the rise in AI-assisted development, sticking to the default directory structure will only help that given that’s what LLMs will be trained on.
martinbean wrote a reply+100 XP
1mo ago
@shivamyadav I’ve worked on probably hundreds of Laravel projects over more than 10 years now, and at companies of all sizes (from SMEs to Fortune 500s). The projects that fell apart and became unmaintainable messes were the ones where developers decided to be “clever” and create their own folder structure, or do “modules”, “domains”, or whatever.
Seriously, stick to Laravel’s default directory structure:
- Put interfaces in an app/Contracts directory, which follows the framework’s convention.
- Use managers for things that can have multiple providers (i.e. payment gateways). Think how Laravel uses managers for components you interact with (cache, queue, etc) where the code doesn’t change if you swap providers (i.e. from Redis to database). Try to strive for the same in your application where you’re relying on interfaces and managers rather than a specific provider.
- If you have different “areas” in your application, then you can sub-namespace controllers (i.e.
App\Http\Controllers\Admin). - For interactions with third-party services, I create a dedicated namespace in an app/Services directory (i.e.
App\Services\Mux). I then treat this folder as a package, so it may have its own Artisan commands, Eloquent models, controllers, routes, etc with a service provider to register those resources.
It Just Works™ and scales, and your Artisan make:* commands still work without having to install horrible “glue” packages. And with the rise in AI-assisted development, sticking to the default directory structure will only help that given that’s what LLMs will be trained on.
martinbean wrote a reply+100 XP
1mo ago
@gedirixin Thanks for signing up just to review and reply to a three year old thread…
martinbean was awarded Best Answer+1000 XP
1mo ago
@vincent15000 If you don’t want people to have your code, don’t give them it.
Any obfuscation can be easily defeated as PHP is an interpreted language. Any encrypted code needs to be decrypted before it can be ran, and obfuscated code is not going to hide anything of interest (such as API keys, database credentials, etc) if someone really wants to see them.
martinbean wrote a reply+100 XP
1mo ago
Are these plans differents products or the same product with different prices ?
@vincent15000 Only you can answer that.
- Can I use swap and change plans? Then they should belong to the same product.
- Do the different plans give access to different entitlements? That they should be separate products.
martinbean was awarded Best Answer+1000 XP
1mo ago
Hmmm ... I wonder how I could use a policy with only a model id.
@vincent15000 That would be absolutely useless. If you call the gate using something like $this->can('update', 1); then how is Laravel supposed to know which model that 1 relates to? 🤷♂️
Stop over-thinking things and just use Laravel’s features as they’re documented.
martinbean wrote a reply+100 XP
1mo ago
@eskiesirius You shouldn’t be using a single column to hold the balance. You should instead of some form of ledger table, where you write individual increments and decrements as their own rows, and then derive the balance from the sum of those increments and decrements. It’s not “expensive” if you have a proper index in place.
martinbean was awarded Best Answer+1000 XP
1mo ago
The application is served via HTTPS in production.
@vincent15000 So stop messing with the cookie prefix, and just set the appropriate configuration option: https://github.com/laravel/laravel/blob/a9fec26463bd62c220702c5d1e9f087c3ca67078/config/session.php#L161-L172
martinbean wrote a reply+100 XP
2mos ago
@vincent15000 It became redundant when Laravel removed Axios from the the default installation, given all bootstrap.js did was import Axios: https://github.com/laravel/laravel/blob/12.x/resources/js/bootstrap.js
martinbean wrote a reply+100 XP
2mos ago
The application is served via HTTPS in production.
@vincent15000 So stop messing with the cookie prefix, and just set the appropriate configuration option: https://github.com/laravel/laravel/blob/a9fec26463bd62c220702c5d1e9f087c3ca67078/config/session.php#L161-L172