koulritesh98's avatar

koulritesh98 liked a comment+100 XP

1mo ago

** Warning **

Do not just use ->markdown() on its own this is prome to XSS (Cross-Site-Scripting) if you was to put <img src="#" onmouseover="alert('hacked');" /> in your idea description or worse a user was, when they hover over the image, an alert will show. Instead use:

    `return Attribute::get(
        fn ($value, $attributes) => new HtmlString(str($attributes['description'])->markdown([
            'html_input' => 'escape',
            'allow_unsafe_links' => false,
            'max_nesting_level' => 5,
        ])));`
koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

2mos ago

Hello, Rather than storing images locally, can we store images right in an object storage like s3 or digital ocean spaces? How would that look like?

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

2mos ago

Hello, I notice that when we removed the image, it closed the modal. Should we rather create a rest api that removes the image, and how would it look like in this flow?

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

@zoki got it. Thank you.

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

@koulritesh98 While developing, you added some new tables or columns to existing tables, after you deployed to production. You add them by writing new migrations. Then, when you update your production site, you also update your table by running "php artisan migrate". It will ask you "are you sure, this is prod?", you answer yes, and the prod DB is updated. It will run only the newly added migrations, not the old ones. How, might you ask? It keeps a list of migrations that have been already run in the DB table called "migrations". Open it and see for yourself.

Of course, it goes without saying: always double check what your migrations are doing and always made a DB backup before updating.

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

@koulritesh98 I think it might be an automatic script that will apply migrations during build or apply stage

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

@sash_ko By migrations do you mean artisan migrations?

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

@yacine_df Thanks a lot.

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

@koulritesh98 There is a course that shows how to deploy a laravel app on a vps, it is introduced by Mohamed Said called "Servers for laravel"

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

Hey @jeffreyway

I was just thinking, when we deploy our apps on production, how will we modify our database by adding new columns? Do we have to manually update all tables in our database?

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

@koulritesh98 I haven't search yet, but I think this is really an area that they could add more content. For example, how to dockerize a modern Laravel application and deploy it to Azure Container Instances.

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

@larsb-dev +1 to that. Also, do you know if there exists any course here that teaches us to deploy laravel apps without using forge?

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

First <3

@Jeffrey Way can you release a series on how to deploy a Laravel app with Docker in 2026 (maybe FrankenPHP)?

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

New Laravel series, lezzz gooo....

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

I totally agree with removing unnecessary comments. What you did should be explained by your code. Why you did it should be explained by your comments if needed.

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

@ruslansteiger Thanks for this explanation, I was actually curious about how would laravel handle nested relations likes job->recuiter->company. Can we also do something like this $jobs = Job::with([ 'type', 'region', 'employer.company', ])->get(); to get all the information about both employers and company along with other relations?

koulritesh98's avatar

koulritesh98 liked a comment+100 XP

3mos ago

@Adam_S you can just chain more relations on the with method. Like this:

$jobs = Job::with([
	'type',
	'region',
	'employer',
])->get();

You can even eager load nested relation. Like this:

$jobs = Job::with('employer.company')->get();

Hope this was helpful. ✌️

koulritesh98's avatar

koulritesh98 wrote a comment+100 XP

3mos ago

Hello, great episode once again. I have a question related to refactoring, when we dynamically used the previous url which we fetched from http referrer header I presume, wouldn't this break if the GET request that shows the form and POST request that actually signs in are different? And can't referrer header be empty as well? Is it safe to rely of this header?