@@sirajul-anik Yes and no :) Proper projects with deployments should use env only in configuration files. Snippet from laravel docks: If you execute the command during your deployment process, you should be sure that you are only calling the function from within your configuration files. Once the configuration has been cached, the file will not be loaded; therefore, the function will only return external, system level environment variables.
you completely forgot to mention the caching part regarding to what APP_ENV is declared, which is not documented and hidden. It seems that anything that is not "local" will cache routes, for example. But i don't find out what/where the logic is. It gets complicated when you not only have "local" and "production" but also multiple stagings and multiple develop environments where caching should not happen but it does. Docs just tell nothing about it
Thanks for this video .Most of developers actually don't know the meaning of these.Keep up the good work.I am wathing your daily videos and I learned so many stuff about laravel from your videos .thaks again.
Nice, I have had one trouble with APP_URL and I changed for full url and then few days there was some parts didn't work. Thanks for sharing your advice.
How can i pass some env values from database ? for example MAIL_HOST or password and etc..I wanna get this kind of data from database , to can make it change dynamicly ??
Can you make a video of how you handle .env variables? Let me explain: I want to separate local / staging / production, I also want my local AND staging AND production connexion to be automatically just by changing APP_ENV. I can't believe there's no solution to just overwrite the same variable when getting from local to prod, why not keeping all important connexion data in the env file and just use prefix? Like this: .env file: APP_ENV=local DB_PREFIX_PRODUCTION=prod_ DB_PREFIX_STAGING=staging_ DB_PREFIX_LOCAL=local_ DB_DATABASE_LOCAL=local_app DB_HOST_LOCAL=127.0.0.1 DB_USERNAME_LOCAL=root DB_PASSWORD_LOCAL='' DB_DATABASE_PRODUCTION=PROD_app DB_HOST_PRODUCTION=prod-rds-endpoint DB_USERNAME_PRODUCTION=your_prod_username DB_PASSWORD_PRODUCTION=your_prod_password So in my database.php it will automatically take the right connexion: $env = env('APP_ENV'); 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_' . $env), 'port' => env('DB_PORT_' . $env), 'database' => env('DB_DATABASE_' . $env), 'username' => env('DB_USERNAME_' . $env), 'password' => env('DB_PASSWORD_' . $env), 'prefix' => env('DB_PREFIX_' . strtoupper(env('APP_ENV')), ''),
@@LaravelDaily ok I will check that, btw thank you for all your content it really helps me getting better and understanding how senior dev use laravel 👍 I really appreciate!
Maybe a good video is how to make sure your emails get into your users inbox and not in their spam folder. It takes a bit of work to verify your domain but this prevents that the user can't find their email.
@@LaravelDaily I've seen the Laravel videos declining lately and people like good tutorials about specific topics. Just trying to give you some ideas here and there that will attract new viewers 😉
Hello sir pls explain to us why when i link my laravel project to multiple databases using a unique connection each the command '' php artisan migrate:fresh '' drop only tables from default DB then show error for other databases (error: table already exist ) pls help ,appreciated for more tips on that topic
hi, i'm your russian fan, i'm studying and i'm having some difficulties with my project laravel + vue. You can shoot a video with authorization and registration via api
Ok, I have a doubt if I will fetch data from DB inside AppServiceProvider boot(), will data fetch only first time from database when server is started or every time when user request on a server.
So in my project, there is an app_key already set. Now, there is another feature to be added where you can store passwords, like a Vault. usercodes and passwords should be encrypted but I am required to use another app_key for it. Could this be possible?
I then understood why. The new welcome page is full of Laravel-related links and tools, so it is actually LARAVEL homepage, not YOUR APP homepage. It makes perfect sense.
The app name is used in the title tag of the base template, app.blade.php. I noticed this as my browser always showed Laravel on the tab unless I updated this value.
You're probably talking about one of the starter kits? Laravel Breeze? Cause in the default Laravel, there's no app.blade.php, only welcome.blade.php github.com/laravel/laravel/tree/8.x/resources/views
@@LaravelDaily Oh, yeah. Laravel UI and Jetstream I've used, and both were that way. However, the title tag in welcome.blade.php seems to be updated to reference the app.name config once a starter kit is added as well.
Hello Mr Laravel Daily please make a video for multi auth with different tables (for example Doctor tables , patient tables and Admin tables etc) with one login form.
Hello Mr Laravel Daily please make a video for multi auth with different tables (for example Doctor tables , patient tables and Admin tables etc) with one login form.
Worth noting:
env() fuction should only be used in config files and not anywhere else 👍
nope, not exactly true. Till you run `php artisan config:cache`. otherwise, it's just okay.
@@sirajul-anik Yes and no :)
Proper projects with deployments should use env only in configuration files.
Snippet from laravel docks:
If you execute the command during your deployment process, you should be sure that you are only calling the function from within your configuration files. Once the configuration has been cached, the file will not be loaded; therefore, the function will only return external, system level environment variables.
you completely forgot to mention the caching part regarding to what APP_ENV is declared, which is not documented and hidden. It seems that anything that is not "local" will cache routes, for example. But i don't find out what/where the logic is. It gets complicated when you not only have "local" and "production" but also multiple stagings and multiple develop environments where caching should not happen but it does. Docs just tell nothing about it
problem , your explanation show something locally.. when we are in a server. step are different. im lost from there. ( i use plesk)
Lol i suffered a lot with this server error problem for about 2 months
Thanks for this video .Most of developers actually don't know the meaning of these.Keep up the good work.I am wathing your daily videos and I learned so many stuff about laravel from your videos .thaks again.
Nice, I have had one trouble with APP_URL and I changed for full url and then few days there was some parts didn't work. Thanks for sharing your advice.
Sir can i set values from database into env file?
How can i pass some env values from database ? for example MAIL_HOST or password and etc..I wanna get this kind of data from database , to can make it change dynamicly ??
Yes you can set something like config('xxx.yyy', DB::table('config')->where()->first()->value);
Can you make a video of how you handle .env variables? Let me explain:
I want to separate local / staging / production, I also want my local AND staging AND production connexion to be automatically just by changing APP_ENV.
I can't believe there's no solution to just overwrite the same variable when getting from local to prod, why not keeping all important connexion data in the env file and just use prefix? Like this:
.env file:
APP_ENV=local
DB_PREFIX_PRODUCTION=prod_
DB_PREFIX_STAGING=staging_
DB_PREFIX_LOCAL=local_
DB_DATABASE_LOCAL=local_app
DB_HOST_LOCAL=127.0.0.1
DB_USERNAME_LOCAL=root
DB_PASSWORD_LOCAL=''
DB_DATABASE_PRODUCTION=PROD_app
DB_HOST_PRODUCTION=prod-rds-endpoint
DB_USERNAME_PRODUCTION=your_prod_username
DB_PASSWORD_PRODUCTION=your_prod_password
So in my database.php it will automatically take the right connexion:
$env = env('APP_ENV');
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST_' . $env),
'port' => env('DB_PORT_' . $env),
'database' => env('DB_DATABASE_' . $env),
'username' => env('DB_USERNAME_' . $env),
'password' => env('DB_PASSWORD_' . $env),
'prefix' => env('DB_PREFIX_' . strtoupper(env('APP_ENV')), ''),
If I understand your problem correctly, that is solved by creating multiple drivers in config/database.php, not in .env file.
@@LaravelDaily ok I will check that, btw thank you for all your content it really helps me getting better and understanding how senior dev use laravel 👍 I really appreciate!
Thank you Laravel Daily
MacBook upgrade :)
Great Thanks
Royal like from me!
Maybe a good video is how to make sure your emails get into your users inbox and not in their spam folder.
It takes a bit of work to verify your domain but this prevents that the user can't find their email.
It's way outside of topic of Laravel, and I'm surely not an expert on email delivery.
@@LaravelDaily It was a suggestion because every laravel developer needs to setup their email provider in laravel and create email templates.
Good suggestion about the PROBLEM, but a wrong person to ask - I'm not qualified enough to talk about it.
@@LaravelDaily I've seen the Laravel videos declining lately and people like good tutorials about specific topics.
Just trying to give you some ideas here and there that will attract new viewers 😉
@@LaravelDaily See , your community is growing!!
Congratulations.
Thanks for sharing
Great, Thanks
Hello sir pls explain to us why when i link my laravel project to multiple databases using a unique connection each the command '' php artisan migrate:fresh '' drop only tables from default DB then show error for other databases (error: table already exist ) pls help ,appreciated for more tips on that topic
I don't work with projects with multiple databases, so I don't know the answer
look this one:
ruclips.net/video/KJAXLf78QPs/видео.html
As you said, "APP_URL" is for URL generation, Laravel uses APP_URL when it's generating URL from the CLI, which means in schedulers, jobs etc
hi, i'm your russian fan, i'm studying and i'm having some difficulties with my project laravel + vue. You can shoot a video with authorization and registration via api
Thanks
thanks
Sir can i set values from database into env file?
No, but you can dynamically set them with config() function
Ok,
I have a doubt if I will fetch data from DB inside AppServiceProvider boot(), will data fetch only first time from database when server is started or every time when user request on a server.
So in my project, there is an app_key already set.
Now, there is another feature to be added where you can store passwords, like a Vault. usercodes and passwords should be encrypted but I am required to use another app_key for it. Could this be possible?
I've never done it like that, so probably it's not possible with standard features, you need to come up with some extra logic for this.
Should APP_DEBUG be true or false during automated tests (phpunit)?
True. When testing, you DO want to see errors if the tests fail, don't you?
Sir, could you please make a video how to deploy laravel in windows server 2019 for local network?
I don't use Windows server, and not really recommend it to anyone.
IIRC, welcome blade used to pull the page title from .env
Not sure when or why was it changed to hardcode. Not that that file ever gets used, anyway.
I then understood why. The new welcome page is full of Laravel-related links and tools, so it is actually LARAVEL homepage, not YOUR APP homepage. It makes perfect sense.
Amazing... I learnt how to search config in code.
I find some overlapping with APP_ENV and APP_DEBUG is there a case you want to have debug=true on env=production or debug=false on env=local?
Yes technically you may combine them like this, but in practice I never needed that
@@LaravelDaily I am not saying I need that, I just find odd that laravel have 2 different inputs for the same concept.
It's not the same concept. Debug is for debugging, and env can be used much broader, for any check
5:53 but what about if the key gets leaked?
Technically, you're in trouble, then, if someone knows how to use this key.
Nothing from the production .env should ever get leaked.
The app name is used in the title tag of the base template, app.blade.php. I noticed this as my browser always showed Laravel on the tab unless I updated this value.
You're probably talking about one of the starter kits? Laravel Breeze? Cause in the default Laravel, there's no app.blade.php, only welcome.blade.php github.com/laravel/laravel/tree/8.x/resources/views
@@LaravelDaily Oh, yeah. Laravel UI and Jetstream I've used, and both were that way.
However, the title tag in welcome.blade.php seems to be updated to reference the app.name config once a starter kit is added as well.
Hello Mr Laravel Daily please make a video for multi auth with different tables (for example Doctor tables , patient tables and Admin tables etc) with one login form.
Hello Mr Laravel Daily please make a video for multi auth with different tables (for example Doctor tables , patient tables and Admin tables etc) with one login form.
I wouldn't personally use such structure, I would put it all in one users table, with maybe some additional fields separately.
@@LaravelDaily ok sir but we want for multiple tables
Ok then, if you want for multiple tables, then build it yourselves. I can't shoot a video teaching something that I think is very wrong.
@@LaravelDaily sir i am sorry but why my method is wrong ?
Watch my video: ruclips.net/video/kZOgH3-0Bko/видео.html