how do I add '/en' or '/fr' after all the base url in laravel 5.8 routes - laravel

I created a project in Laravel 5.8. I just started working on adding multiple languages in my website. How do I make it so if I click on the language button to choose french the website will load every page as /fr/<rest of the url
Like this
when selecting english language
when selecting bangla language

When the button is clicked you should set the desired locale, this can be done using App::setLocale($locale)
The documentation of Laravel explains how you could do this, for your exact use case:
Laravel Configuring The Locale

Related

how to add or edit gravitar within laravel

I know that we can user the gravitar in laravel for display pic but how can we add one if the new user doesn't have it or wish to update the current one from within the application?
below article shows how to show existing gravitar in laravel.
How do I implement Gravatar in Laravel?
You can supply a default image through the Gravatar URL.
Documentation.

Locating the main website (front page) file in cpanel for website built on laravel and voyager

I am trying to locate the file or folder in cpanel that the front page of my website is housed in so i can add a floating action button script to my website.
I just have no prior experience here.
(I am trying to add this in correct place)
It should have a finished result as here http://www.floatingactionbutton.com
The views or 'pages' of the application should be in the resources/views/ directory. You may find a view that is 'home' or something similar but there is no way of knowing what the views have been named when your application was developed.
The views may not be in straight HTML / PHP but rather use Laravel's Blade syntax.
In addition, existing javascript files in your site may have been compiled using Webpack. I imagine the floating action button will be a javascript script.
Can you get the original developer to add the script for you?

Translate Laravel application with locale from user and without display parameters in URL

I am trying to launch a multilanguage application with Laravel.
I would like the user to choose the language of his application. To do this, I created a "language" column in my database that records the user's preferred locale.
I can recover his preferences by doing this
Auth::user()->language)
In my .blade file, do this doesn't work
#if(isset(Auth::user()->language))>
{{ App::setLocale(Auth::user()->language) }}
#endif
I would like to find a way to translate my application according to the preference of the user but WITHOUT displaying the locale in the url.
Is it possible ? How? Thank you !
I suggest to make middleware, i.e. 'LocaleSwitcher', with your code inside
App::setLocale(Auth::user()->language)
And attach it wherever you need

Broadleaf - Extending DemoSite Admin - Add new Menu and Page

I have been looking into Broadleaf since last couple of days. I have managed to run it on local tomcat with MySql. I have extended Entity for my custom requirement following Broadleaf's documentation.
Now I want to add a menu option (in left menu) in admin. I have no clue from where Broadleaf admin site displays the web page. How left menu is displayed ? How data from controller are binding with view ?
For example, if you access product page in broadleaf admin section, then URL will be http://localhost:8081/admin/product/. Following it I managed to know that it calls AdminProductController.java of framework's admin module. I looked at the code of AdminProductController.java but didn't get a clue how data is being forwarded to view. Also didn't find the product jsp/template/html.
I guess admin module is using EntityForm.java for view. If I intend to use simple jstl then is it possible?
My question how easily I can extend admin of Heat Clinic demo site to add new pages, menu items etc? If anyone has customized/extended demosite admin then please suggest.
We have some docs on how to do this at http://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/admin/admin-custom-controllers. The bottom line here is that if you want to add a new page then you can simply use normal Spring MVC as you would on the frontend. The only difference is that there are some specific ways to place new template files (which is documented on that page).
To answer your question, most URLs in the admin are handled dynamically by the AdminBasicEntityController. Most of the sections are handled generically by this controller but there are still certain instances where we needed to override things specifically, like with AdminProductController.
Also, the admin is built with Thymeleaf and not JSPs so if you want to add more pages they will need to be done with Thymeleaf.

Joomla 2.5 language code in URL. How to disable?

I have Joomla 2.5 with built-it multilanguage system. Main language is russian and second is english.
In 2 specific articles I have iframes with src="/freeflight2/form.php". In russian version of the site the iframe loading correctly. But in english I get URL of iframe with language code: http://xxx/en/freefligh2/en/form.php which causing 404.
I also tried to write full url, but Joomla again inserting language code.
Is there any way to fix it?
Is this custom or within Joomla? If custom have you tried using JPATH to get the base path? If within Joomla are you using an editor like JCE to create the iframes?

Resources