In laravel can I have default lang folder? In other words now I have
lang
en
lang
ru
I don't need to have each folder for each language because I read data from the database. I need something like this and it must work for all locales. Is it possible?
lang
def
In config/app.php:
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
The default fallback folder by default is lang/en. You can change it to def
Yes, you can have multiple languages in the same lang directory without additional configuration. Check the docs if you need additional guidance.
Related
I use laravel jetstream, and I would like to redirect user to a specific route /admin/produit after login.
change this line in RouteServiceProvider.php
public const HOME = '/';
to
public const HOME = '/admin/produit';
Laravel Fortify is what is used in Jetstream, you can change the default location of redirects after login in your config/fortify.php
/*
|--------------------------------------------------------------------------
| Home Path
|--------------------------------------------------------------------------
|
| Here you may configure the path where users will get redirected during
| authentication or password reset when the operations are successful
| and the user is authenticated. You are free to change this value.
|
*/
'home' => RouteServiceProvider::HOME,
Alternatively you can set this during runtime with Config::set("fortify.home").
Furthermore if you need really complex behavior you can change entire Fortify Reponse class:
https://talltips.novate.co.uk/laravel/laravel-8-conditional-login-redirects
I am using Laravel 6, my project is working fine, but when I enter wrong login details, I am getting an error.
These credentials do not match our records.
How I can modify this error message and provide my custom message if there's an error in the user name or password. I tried to find this message in LoginController and Laravel vendor folder, but I couldn't find it. Can anyone please tell me the exact location of that file where this error message is located?
You can change it in /resources/lang/en/auth.php.
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
You can find that on this location
resources/lang/en/auth.php
if you want someting custom and more specific check AuthenticatesUsers.php and override function sendFailedLoginResponse in LoginController.php
I have a problem with hiding the programming Language (Laravel 5.5) of my website
I tried a lot of different ways but did not get any result.
I changed my session config/session.php:
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
but it hasn't worked.
If you do not want to show the programming language of your Website in Chrome extensions then you have to change the setting in php.ini
change expose_php = On
to
expose_php = off
You can also tweak it in your .htaccess.
Hope it helps.
You may need this basically for security reasons. When somebody installed this plugin (https://wappalyzer.com/download) on the browser, s/he can see all the frameworks and javascript libraries among other things.
So hide framwork name from plugin , just go in config/session.php file and edit bellow code
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'yourname_that_you_want_to_add'), '_').'_session'
),
Sometimes when i bring changes in CSS or in HTML contents or maybe controllers, i refresh many times but the change not applies in the app and it still looks like the past. Does anyone faced this problem? or how i'm going to solve this issue?
If you're not using PSR-4 autoloading. You'll need to reflect new controllers with $ composer dump-autoload -o (note the -o optimises the class-mapping).
Other than that, are you behind any caching drivers?
For good measure, change the following in your development cache config(\app\config\development\cache.php) (Don't have a development folder? Read this) as well:
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
'driver' => 'file',
Laravel will store all your cache files in the following folder: app\storage\cache and view caches in: app\storage\view. Clear both when necessary.
When we receive mail from our website, through CodeIgniter first then Google Apps (mailer) - the date in the header is 7 hours behind the real time.
We've checked the server time, and it is correctly set.
Has anyone experienced this problem?
Thanks!
It may have something to do with this setting in system/application/config/config.php:
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are "local" or "gmt". This pref tells the system whether to use
| your server's local time as the master "now" reference, or convert it to
| GMT. See the "date helper" page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';