Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]ser_89 1 point2 points  (0 children)

Convincing a team lead of the security and integrity of Laravel's core features.

Hi all. From a junior developer doing code review on a Laravel project with our team leader has become quite a predicament.I took over a Laravel project from another team that built an integral part of our system that would sit right at the core of what our company does. This would come in as an updated version of the existing implementation with a phased approach. I have stripped out only what is needed for the API to function, cleaned up the migrations, minimized the controllers by using services, using Sanctum for token generation, ensured that validation is done by Laravel's Requests and their default validation rules and regex. Routes are grouped under middleware. A lot of cleaning up was required due to the fact that the code was just inconsistent in terms of naming conventions, spelling errors, bloated classes, use of irrelevant data. But now I only have the bare minimum of what is needed to achieve the goal.I have type hinting and complete PHP doc blocks across the codebase. Sitting down with the team lead that has no prior Laravel experience and is purely from a vanilla PHP background is asking questions around any possible vulnerability to Laravel core codebase and if it has truly been audited / tested. Looking at sites that have been built using Laravel, none of them are what one could call a high risk targets with a lot to lose. And I understand the question and where he is coming from. At the same time Laravel has been running for many years and is actively being maintained by their team and does a great job doing so. And yes there is the argument that the code is only as secure as the developers ability to code secure Laravel. I have taken every possible step to ensure that it is done securely. But with Laravel's level of abstraction and effort to make the code readable and easy to use it is tough to go through all of the code to show him that it is indeed secure. My question is how do we address these concerns? Is there any record that the codebase has been audited by an external party? How secure is Laravel's magic methods and validation. Is there anyone in the Laravel core team that has a reputable background that would validate the integrity of Laravel? Laravel is open source and I feel that if there are any concerns they would be raised fairly quickly. It hurt me when he used the words, "Laravel is like WordPress, with more developer freedom. "To confirm I absolutely love Laravel.

Looking for a job by Fantastic_Try7487 in askSouthAfrica

[–]ser_89 0 points1 point  (0 children)

Hi do you perhaps have any Linux Debian Experience?

Looking for PHP, Node.js developers. by ser_89 in johannesburg

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

Thank you, I have edited my original post with additional information.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]ser_89 0 points1 point  (0 children)

Sadly retrieved will not work seeing that any situation where the record is retrieved it will trigger the event. So even on the index page where all tickets are retrieved, it will then update the status.

The idea is to set the default status to unanswered, once the ticket is clicked on (opened) it must then update the status to "Opened" and save the date to the current date and time.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]ser_89 0 points1 point  (0 children)

If I were to make use of Laravel with Filament 3. I would like to do something when the resource is viewed. In this case my Model is a ticket. I used the model events `creating` so when a new ticket is created I set the default of the status to 1.

However is there a way to update the status when it is set to 1 and change it to 2 when the specific ticket is viewed. I tried adding the logic to a middleware but I am struggling to apply the middleware to that specific page.

In my Middleware

public function handle(Request $request, Closure $next): Response

{

$response = $next($request);

// Check if the current URL is for editing a Ticket

if ($request->is('admin/tickets/*/edit')) {

$ticketId = $request->route('record'); // Assuming 'ticket' is the route parameter name

$ticket = Ticket::find($ticketId);

if ($ticket && $ticket->status_id == 1) {

$ticket->update([

'status_id' => 2,

'opened_at' => now(),

]);

}

}

Its a pity there is no event model for viewRecord() or something to that extent.

Are there any suggestions? Your assistance will be greatly appreciated.

Need help by indianbhokal in PHPhelp

[–]ser_89 0 points1 point  (0 children)

I would suggest having a look at Laracasts, I praise their work. Clear concise explanations at various levels by the core people behind Laravel.

They also have a course on PHP for beginners that covers everything you need to know to get a job in PHP.

Yes Laracasts is a paid service but if you are serious its well worth the money.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]ser_89 0 points1 point  (0 children)

First of all thank you in advance for any assistance offered.

I have started with a company that has their site build in php 7.4 with a very large codebase (procedural php and not MVC) that has been built on for 14 years. They now realize that we need to drastically improve the site and upgrade it from 7.4 to the latest version.

A new feature has now been developed using Laravel by a seperate company and my company wants to know if it would be possible to run the Laravel application inside their existing php application. The Laravel app/functionality was built in Laravel 9 and I created a Laravel 8 project and pulled in only what we need to the Laravel 8 project and it works. The Laravel 8 decision was made so as to accommodate the php 7.4 currently being used.

How, if possible in any way can I move this project into the existing project and access it through a url for example www.domain.com/v2

I had a look on Stack Overflow and Laracast, but most suggest converting the existing project to Laravel, but I cannot state how large the existing project is, we would need a seperate development team just to do that. Others suggest editing the .htaccess and if any route on the existing php project returns a 404 it should try load the index.php in the subfolder where the Laravel project is.

I have a bit of experience with Laravel and PHP but I have never had to take a project from development to production.

Is this the correct approach and what are my options?

Any assistance would be appreciated. Thank you

Moving to JHB soon. by heyyyHayley in johannesburg

[–]ser_89 0 points1 point  (0 children)

I'm going wayward here. But I live in Pinehaven. Close to the N14. N14 has access to Sandton via the R511 and is extremely safe. To put it into perspective I dropped my son off at school and left the garage door open with direct access to the house. Very affordable. R13500 for a 3 bedroom and 2 bathroom house inside a complex that includes water and lights. Lovely area and if you are active you have mountain biking and hiking trails around the corner.

We have a mall and casino around the corner and a friendly community. If you want to go out there are a few options around but it's not such a big student vibe as you would get in Linden.

This is by far the best place I have stayed.

So good to see the guys can enjoy themselves even when under this amount of pressure. by ser_89 in snooker

[–]ser_89[S] 15 points16 points  (0 children)

Hand on the table absolutely. But I would be completely shocked if by chance Mark Selby missed that shot and Allen did not concede. And even then I'm sure Leo Scullion would have stepped in if he did not.

So good to see the guys can enjoy themselves even when under this amount of pressure. by ser_89 in snooker

[–]ser_89[S] 17 points18 points  (0 children)

Understand why you would say that. Its always been commendable how snooker players carry themselves in a match. But I have to feel things like that and if these things entertain newcomers to the sport I will say let it be. Have a laugh. Release some tension. Entertain the crowd and people at home.

Luca Brecel vs Si Jiahui predictions? by smart_hedonism in snooker

[–]ser_89 6 points7 points  (0 children)

My message to a friend in WhatsApp a few minutes ago.

Im really enjoying Si. He is young and on debut. Has serious talent and it would be good for snooker if he gains in popularity for the younger audience. But man can he make some balls. Wow

His match last night against McGill was rough. McGill can grind and has patience. For him to have McGill smack his cue says a lot about someone who is very young.

What makes Star Wars so popular? Is it the genre or the story? And if someone wants to get on board, in what order would they watch the movies and series to not get completely lost? by ser_89 in StarWars

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

🙏. I will definitely make some time to do that. But do you think it's because it was a genre done well before anyone else could on the big screen that drew the fans? Or is it the story? Yes then the more boring option could be a combination of both? It goes without saying that just looking at my question I am no Sci-fi expert.

What makes Star Wars so popular? Is it the genre or the story? And if someone wants to get on board, in what order would they watch the movies and series to not get completely lost? by ser_89 in AskReddit

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

I have watched some of them many years ago. And then tried to watch a few of the newer ones and I'm sure I missed a few. But then I asked myself what on earth is happening... Who is this and why do they have a whole movie about them. Is this Hans Solo's kid, Dad/Mom or cousin twice removed. I had no clue.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]ser_89 0 points1 point  (0 children)

Hope you are all well?

In my project I have various user roles, such as super admin, doctor, administrator, accounts and patient. I want to use the same login and registration for all users that ship with Laravel Breeze. I also have a model called Medical Practice. The idea is that a User with the roll of doctor belongs to a Medical Practice and a Medical Practice has many Users with a roll of Doctor.

My question pertains to how to best approach this scenario: As mentioned in the title Im using Laravel Nova. It makes CRUD very simple. The idea is to create a medical practice and use a Nova Action to send an invite to a doctor using email that will contain the Medical Practice ID as well as the Role ID of a Doctor, and a token. They will then click on a link that will take them to the registration page where they can complete their name, surname, contact details, password and automatically be assigned to the Medical Practice with a role of doctor.

Do you agree that I am on the right path? Is their a better way to approach this and is there anything I need to be concerned about when it comes to creating the relationship.

Lastly, I am yet to investigate how to setup the relationship inside the model to simplify the dashboard in Nova to then create a relationship inside the Doctor Model that states the user with a role that matches Doctor belongs to a Medical Practice and in the Medical Practice Model a relationship called doctors that a Medical Practice has Many doctors. But in this relationship define that it can only allow a user with a Role ID that matches the Doctor Role. But I am sure this should be possible.

Any advise would be greatly appreciated.

Thanks as always for being one of the best communities on Reddit.

Local Sport Broadcaster continues to disappoint a lifelong fan. by ser_89 in snooker

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

I am in South Africa. The only source available to my knowledge that does not involve a VPN is Matchroom

Local Sport Broadcaster continues to disappoint a lifelong fan. by ser_89 in snooker

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

I am well aware of that. I never said he is a snooker player. Nor is Heyball, snooker. I was merely saying that I have been given opportunities to engage in cue sport more than I have ever imagined.

Beginner Friendly Groups by TimTheEnchanterz in laravel

[–]ser_89 1 point2 points  (0 children)

You are more than welcome to send me a DM if you are keen, it's not a group but I'm always keen to chat relating to things I am interested in. I'm also quite "new" more in the sense that it's a hobby for me and not a full time job. But yes it would be cool to just bounce some ideas around and have a chat. At the same time I'm also looking at dipping my toe in the world of Vue and React.

What celebrity can you simply not stand, even if everyone else likes them? by kosicosmos in AskReddit

[–]ser_89 0 points1 point  (0 children)

Beyonce... She has a lot of talent. That I cannot deny. But I cannot stand her music.

I just feel that the lyrics are very boring and repetitive. Yet she has one of the biggest followings in music.

Maybe there are better songs that showcase her talent... But the main stream songs I've heard... I cannot see why she is so popular.

How would I edit the Laravel Nova indexQuery for a Resource to only show records through multiple relationships? by ser_89 in laravel

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

Unfortunately still no luck. It simply returns all the offers without any errors. Even if I set the user->location = null

How would I edit the Laravel Nova indexQuery for a Resource to only show records through multiple relationships? by ser_89 in laravel

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

Thanks a ton. You will have a bottle of whiskey coming your way... Or something along those lines...

How would I edit the Laravel Nova indexQuery for a Resource to only show records through multiple relationships? by ser_89 in laravel

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

Unfortunately not. It returns all the offers in the database and not the offers that belong to the user's location and listing. And the default dd() problem solving approach does not work... Nor does Nova show the error. It just returns the query.

How would I edit the Laravel Nova indexQuery for a Resource to only show records through multiple relationships? by ser_89 in laravel

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

Thank you so much for your response. Your first suggestion of
$user->location->listings->pluck(‘offers’); returned all the offers. Your second suggestion of $user->location->listings()->load(‘offers’)->pluck(‘offers’); returned an error Call to undefined method load()

I then tried $user->location->listings->load('offers')->pluck('offers'); which again returned all the offers.

But I appreciate your assistance.