Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic insertion of settings required for front-end integration #394

Closed

Conversation

seito-developer
Copy link

@seito-developer seito-developer commented Jul 8, 2024

Dear Laravel Breeze Team,

Hi, let me send my PR here.

What I did

Fixed to automatically append the code needed for API integration with the frontend.
When the command php artisan breeze:install is executed, 'frontend_url' => env('FRONTEND_URL ', 'http://localhost:3000 '), is appended to the end of config/app.php.

Benefit for developers

In the current version, FRONTEND_URL is appended to the .env file when the php artisan breeze:install command is executed, but the code to read it 'frontend_url' => env('FRONTEND_URL ', 'http://localhost:3000'), must be added manually to config/app.php.
This is not clearly stated in the tutorial in the official documentation (https://laravel.com/docs/11.x/starter-kits) and is kind for developers.

This fix solves them automatically, so developers can implement user and email authentication without hesitation.

Best regards,
Seito Hriguchi

@taylorotwell
Copy link
Member

It already exists in the base framework app config?

CleanShot 2024-07-08 at 18 27 56@2x

@seito-developer
Copy link
Author

seito-developer commented Jul 9, 2024

@taylorotwell
Hi,
Is the base framework app config you mean is this one?
https://github.com/laravel/laravel

I couldn't find that code in config/app/.php.

@askdkc
Copy link

askdkc commented Jul 9, 2024

@seito-developer

framework app config is this:
https://github.com/laravel/framework/blob/0e9053da9d709c544200260cc0be5e223ea8ff93/config/app.php#L60

If your laravel app cannot find 'frontend_url' => env('FRONTEND_URL ', 'http://localhost:3000') in condig/app.php then it will look for vendor/laravel/framework/config/app.php.

So you don't need to add 'frontend_url' => env('FRONTEND_URL ', 'http://localhost:3000') to condig/app.php.

You can actually test this. Just create new laravel app without breeze.

laravel new testproj
cd testproj
php artisan tinker

> config('app.frontend_url')

Then it outputs

= "http://localhost:3000"

@seito-developer
Copy link
Author

@askdkc
Thank you, I got it.
But the official Web page says that we can start to command composer create-project laravel/laravel example-app.
Should it be fixed to composer create-project laravel/framework example-app ?
https://laravel.com/docs/11.x/installation

@askdkc
Copy link

askdkc commented Jul 9, 2024

@seito-developer

I use laravel installer (less typing).

If you look official documents throughly it also mention laravel installer

Or, you may create new Laravel projects by globally installing the Laravel installer via Composer:

composer global require laravel/installer
 
laravel new example-app

@maru0914
Copy link

maru0914 commented Jul 9, 2024

@seito-developer

But the official Web page says that we can start to command composer create-project laravel/laravel example-app.
Should it be fixed to composer create-project laravel/framework example-app ?

There is no problem if you create a project by composer create-project laravel/laravel, because laravel/framework will be installed automatically when the command is executed.
Therefore, I think there is no need to fix the documentation.👍

Test these commands.

composer create-project laravel/laravel example-app
cd example-app
php artisan tinker
> config('app.frontend_url')

Output:

= "http://localhost:3000"

@seito-developer
Copy link
Author

@maru0914 @askdkc
Thank you!
I understand that Laravel loads ./config/app.php and also loads config/app.php in vendor/ to compensate for the lack of settings after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants