meduz wrote a reply+100 XP
4w ago
It seems the screenshot is missing from your message.
If by “stack” you mean it looks like the new page is in a modal on top of the current page, it’s maybe a situation where your back-end (e.g. the controller) does not use Inertia::render. Maybe it returns JSON directly, or HTML (using view()).
You can only use <Link> for things handled by Inertia, otherwise you should use a regular <a> tag.
meduz liked a comment+100 XP
1mo ago
@jkonline123 I think the reasoning was that there were a lot of files in the Middleware folder that in 99% of projects just go untouched. Basically just streamlining the scaffolding to reduce the feeling of “oh that’s a lot of files” for those new to Laravel.
meduz liked a comment+100 XP
1mo ago
As this page ranks in highly in Google I also got the same error due to an incorrect route definition of an invokable controller.
$r->get('{id}/verify-email', [PurchaseOrders\AnalysisController::class])
caused the error. Removing the wrapping array resolved the issue:
$r->get('{id}/verify-email', PurchaseOrders\AnalysisController::class)
meduz liked a comment+100 XP
1mo ago
In Laravel 11, the approach to registering facades has been streamlined to encourage the use of fully-qualified class names directly, which is more in line with modern PHP practices. However, if you still want to use aliases for your facades, you can register them in your application's service providers.
Here's how you can do it:
- Create a new service provider or use an existing one. If you're creating a new one, you can use the
artisancommand:
php artisan make:provider AliasServiceProvider
- In your service provider, within the
registermethod, you can use theAliasLoaderto register your aliases. Here's an example:
<?php
namespace App\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class AliasServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Get the AliasLoader instance
$loader = AliasLoader::getInstance();
// Add your aliases
$loader->alias('Setting', \App\Facades\Setting::class);
$loader->alias('HelperMethods', \App\Facades\HelperMethods::class);
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
- Finally, you need to register your new service provider. Add it to the
providersarray inconfig/app.php:
'providers' => [
// Other Service Providers
App\Providers\AliasServiceProvider::class,
],
Now, Laravel will register your aliases when the application boots, and you'll be able to use them just like you did in previous versions of Laravel.
Remember that while aliases can be convenient, they can also lead to less clear code, especially for new developers on your team who may not be familiar with the aliases you've set up. It's generally recommended to use the fully-qualified class names for clarity and better IDE support.
meduz wrote a comment+100 XP
2mos ago
Hey Matt, I’m really enjoying this series so far. It’s a pleasure to see my observations through years are shared by others.
It’s also the first time I see someone from the Laravel community mentioning the environment when talking about AI. Finally! So thanks for this. It’s a concern that needs to be shared more broadly (and it’s not the only “externality”). I wish others with a voice would follow your steps in this.
Now resuming the series. 🤓
meduz liked a comment+100 XP
3mos ago
First don't be too hard on yourself. Everything you stated as challenging are very large areas of programming in general. Everyone finds them challenging. The good news is their are various courses on Laracasts that can help you.
I had difficulty with Testing and I'm still not great a it. I found watch this course help me a lot.
https://laracasts.com/series/php-testing-jargon
Also I recommend reading the Laravel documentation. I know it sound scary but the documentation is very human friendly to read and understand.
If you just struggling with the PHP in general I would recommend "PHP For Beginners" and the "PHP Crash Course" on Laracasts.
Authorisation is a massive topic and even after all my 20+ years as a developer I'm still learning on this subject. The best way to pick it up is to create a simple app yourself.
Start with a Laravel start kit. Use something like Laravel Breeze starter kit and learn to use the existing Auth process. By doing this you will learn the basics and you can look at the start kit codebase and start reading it to understand what going on.
Here a very good Laracasts course on the subject
https://laracasts.com/series/laravel-authentication-options
If you still don't understand I suggest copying the script into chatGPT and asking it to explain in detail what each line does and why, it can be a helpful exercise if you don't understand something.
Gate and Policies sound more complex than they really are. They are just layers you can add to system security. You don't have to master everything all at once. Just learn to get comfortable with Authorisation then once your good start playing with Gate...then Policies. Before long you will start feeling comfortable with everything.
Just remember programming is creative exercise and you learn through play. So just have fun and play.
As far as Vite and UI I would recommend watching.
https://laracasts.com/series/laravel-and-vite
I hope the above helps you and if you have any particular questions just let me know and I've tried and explain it to you.
All the best :-)