Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

6d ago

I accidentally deleted a Controller. How to recover?

Sometimes you are able to just click into the window where the files are (I am using VSCode) and press Ctrl + Z to go back. If you have reset the machine the state may be lost forever.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

6d ago

I accidentally deleted a Controller. How to recover?

If you're using vscode, there is timeline local history that can be used to retrieve lost file. This only if you're not clearing any temporary file in your OS

Image

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1w ago

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1w ago

Event-Driven Architecture, do I need it?

I regularly use AI.

When I started using AI, I was impressed about the results, but there was frequently errors, too frequently. I lost time because of using AI.

Now I'm using AI only to save time for writing code I already know how write it, but much faster to write by the AI : I say to AI exactly what I want and there are less errors, I just have to correct some mistakes.

If you don't know what you need, the AI is not the best approach to code.

You must know what you need, then you can explain the AI exactly what you need, and the AI executes.

According to me you don't need EDA for your example.

I often say to me that I should always code as easy as possible (KISS principle).

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

1w ago

Event-Driven Architecture, do I need it?

So am progressing with the website with the help of AI, and its telling me I should implement event driven architecture for my stock/ items page.

Reading through it, it looks pretty complicated. Here is a snippet of code.

app(AdjustInventoryStockAction::class)->execute(
    item: $item,
    newQuantity: $validated['quantity'],
    type: 'adjustment',
    reason: 'Manual inventory update',
    performedBy: Auth::id(),
);

Should I bite the nail and continue down this road since it will eventually lead to a better product, or is AI leading me on a wild goose chance?

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

4w ago

Reverting from PEST to PHPUnit

When starting the laravel app creation, I went for PEST, but now I realise I don't actually like it and prefer the look of PHPUnit. I've noticed that pest comes with a lot of preloaded scripts to test for specific functionality, my guess in that the same kind of script come with PHPUnit. Is there a script I can run to remove Pest and go with Unit?

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

4w ago

What about creating a NativePHP channel ?

I for one think its a great idea and I want to thank vincent15000 for bringing NativePHP to my attention. Thoroughly excited.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

4w ago

Leaderboard : experience is not the same according to the view

I feel like the leader board isn't fair. Martinbean has provided 1700 best answers. This makes me suspect that best answers doesn't hold as much weight as other criteria. #FreeTheBean 🫘

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel 13 InertiaJS No Tooltip Provider 🪳

Completely, I had to ask an LLM for advice. It said that I should make a New Issue. I have no doubts he would have seen this post.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel 13 InertiaJS No Tooltip Provider 🪳

So confused. Not sure what to do.

https://laravel.com/docs/13.x/contributions

To encourage active collaboration, Laravel strongly encourages pull requests, not just bug reports.
https://github.com/laravel/react-starter-kit/compare/main...JoshuaHeathcote1987:patch-1?expand=1

An owner of this repository has disabled the ability to open pull requests. 
Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel 13 InertiaJS No Tooltip Provider 🪳

Its not intentional because the sidebar is missing, and using AppLayout then throws the error.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

Laravel 13 InertiaJS No Tooltip Provider 🪳

Good catch. This looks like a scaffolding bug in the starter kit where it missed pulling the TooltipProvider from the upstream shadcn/ui sidebar component.

Your fix is spot on. For anyone else finding this thread, just manually patch your resources/js/components/ui/sidebar.tsx:

Ensure the imports are there at the top:

import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"

Wrap the main div inside your SidebarContext.Provider:

return (
    <SidebarContext.Provider value={contextValue}>
      <TooltipProvider delayDuration={0}>
        <div
          data-slot="sidebar-wrapper"
          style={
            {
              "--sidebar-width": SIDEBAR_WIDTH,
              "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
              ...style,
            } as React.CSSProperties
          }
          className={cn(
            "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
            className
          )}
          {...props}
        >
          {children}
        </div>
      </TooltipProvider>
    </SidebarContext.Provider>
  )
}

If you have a spare few minutes, it's worth opening a quick PR or issue on the Laravel Breeze/Jetstream GitHub repo (depending on which you used to scaffold) so the team can patch the stubs for everyone else.

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

1mo ago

Laravel 13 InertiaJS No Tooltip Provider 🪳

Laravel, the tool tip provider is missing from sidebar.tsx.

Relative path

resources\js\components\ui\sidebar.tsx

Bit missing

<TooltipProvider delayDuration={0}>

How the code looked on older version

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel Auth Pages

Laravel what have you done, change it back 😭

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel Auth Pages

Okay, its no big deal, but it just affects my flow.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laravel Auth Pages

I'm using Inertia React and it looks like this

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

1mo ago

Laravel Auth Pages

Whats going on with laravel auth pages, why are they no longer wrapped with a layout?

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Is it worth it to learn all the courses and coding when AI can make the production level application

If you're serious I would chill and watch the courses. But you need a path you want to go down, usually which front end you're using is the big question.

I'd follow the courses. I wasted Hella time not watching 😞

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Laracasts worth it?

I think if you're new go for it and give a month or two of studying. I think you're lucky to have it because it wasn't around when I started and everything has changed so much especially front end.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

GraphQL 🤔

😂😂

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

GraphQL 🤔

"They" are being silly.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

GraphQL 🤔

Well they say less code, fewer requests and faster results. Sounds like a win win to me.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

GraphQL 🤔

Probably if he doesn't know if he needs it, he doesn't.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Do you struggle remembering Laravel collection methods and PHP syntax during interviews?

Print them out on sheets and stick em around. Anything to do with memory is just repetition.

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

1mo ago

GraphQL 🤔

Is it any good?

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Axios Hacked! ⚠️

Great idea. Maybe its time to put the use axios on the back burner.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

Axios Hacked! ⚠️

If you are using inertia, it seems like a good time to switch to the new http request helper in v3. https://inertiajs.com/docs/v3/the-basics/http-requests

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

Axios Hacked! ⚠️

That's why I miss the good old pencil and paper days. Or at least the old MSDOS days.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

1mo ago

Axios Hacked! ⚠️

I download the actual code no library:

That IS the library. It can have malware whether you install it via npm or manually.

In this case, attackers included a package install script to install the RAT. A direct download couldn't do that, but it could contain other malicious code.

Npm has an automatic audit for vulnerable versions, unlike direct downloads.

But how much damage was done, other servers could have been hit as well. Depending on how the malware was written.

That wasn't what I meant. This is a serious attack. My point was that there's nothing to wait for because the compromised versions were removed over 24 hours ago.

I have never even used NPM.

Ok, but the rest of the industry does. And you still use other package managers, such as Composer and, presumably, some Linux package manager. Those have suffered supply chain attacks just like this.

While these attacks are a nasty, in the real world you can't get away with a zero trust approach. You're relying on many layers of software just to run a web app. It takes vigilance.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

1mo ago

Axios Hacked! ⚠️

The guy is saying that he was hacked. But he had a bunch of security and knew the score. The cynic in me says there is more to this than meets the eye.

I believe the situation needs a full blown investigation.

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

1mo ago

Axios Hacked! ⚠️

Or was it 🤔

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

2mos ago

Help, login in page redirecting to default laravel login page

You actually need all of those use statements?

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

2mos ago

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

2mos ago

Help, login in page redirecting to default laravel login page

Just think on this.

A user is a user, don't overthink, or over engineer.

Use a single login page, and handle it with roles/types of users.

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

3mos ago

My code is a 🤬 mess

This is what I do.

  1. Write code to a make a feature work.
  2. Refactor/ clean up the code of said feature.
  3. Start with the next feature and repeat.

If you push on and finish the product, it is likely that you never clean up the code.

So I'd say C. clean up some code, write a feature, clean up some more code until you are done. Make small improvements of the code in iterations, don't try to clean it up all at once, it will likely be overwhelming.

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

3mos ago

My code is a 🤬 mess

Do I

a) keep pushing forwards until I have a complete product
b) stop now and take a week sorting out everything
Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

3mos ago

Help, login in page redirecting to default laravel login page

when I click the link it just redirects me to the login page

What link?

Randy_Johnson's avatar

Randy_Johnson liked a comment+100 XP

3mos ago

Help, login in page redirecting to default laravel login page

Do you have any starter kit setup or any extra route for the login named below these routes

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

3mos ago

Help, login in page redirecting to default laravel login page

Thanks guys. I found it. It was in my AppServiceProvider

    Route::middleware(['web', 'auth'])
        ->group(__DIR__ . '/../../routes/web.php');

Thank you for listening and many blessings to you all

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

3mos ago

Help, login in page redirecting to default laravel login page

The link on my front page which is to /education/login-portal

There is an issue where I am trying to add a school login page which isn't that of Laravel login. When having the route in the package education web.php it gets pushed to Laravel login but having it in the root web.php it works.

If continuing to log in, it then displays the page, so I am guessing there is some gate somewhere. I am using the standard laravel login which is installed in the creating of the app.

Randy_Johnson's avatar

Randy_Johnson wrote a reply+100 XP

3mos ago

What should I do

If you're strapped for time, follow Laravel. Everything you will come up with in the end using PHP is already done with Laravel.

Randy_Johnson's avatar

Randy_Johnson started a new conversation+100 XP

3mos ago

Help, login in page redirecting to default laravel login page

Hi, I created a login in portal so that the user is given the choice to login as admin (will probably hide this later) , student, etc. but when I click the link it just redirects me to the login page. But there is absolutely no reason for it to do so.

<?php

use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Education\App\Models\School;
use Education\App\Models\Building;
use Education\App\Models\Classroom;
use Education\App\Models\Expense;
use Education\App\Models\Message;
use Education\App\Models\Fee;
use Education\App\Models\Teacher;
use Education\App\Models\Subject;
use Education\App\Models\Student;
use Education\App\Models\Form;
use Education\App\Models\Thread;
use Education\App\Models\SchoolFinance;

Route::get('/login', function () {
    return Inertia::render('Auth/Login');
})->name('login');

Route::get('/education/portal', function () {
    return Inertia::render('education/login-portal');
});

PS. I had a problem posting this as well, I selected Laravel and it said recapta failed - or something along them lines.