How to use db instead of Laravel localization config file - database

I'm using mcamara/laravel-localization. I need to get languages from db instead of laravellocalization config file. Any ideas how to do that. I would be so grateful.

Your best option is to use the laravel translation loader:
Install Laravel translation loader through Composer:
composer require spatie/laravel-translation-loader
Then publish Laravel translation loader migration file:
php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="migrations"
Finally, run the migrations; it will create a new table called language_lines in the database:
php artisan migrate
UPDATE: for laravel 6+ see the Issue # github
source: Laravel news

Related

How to clear cache for database settings in Laravel 8?

I have deployed my project on my webserver. The .env contains the right settings for the web database but for some reason Laravel still try to connect to localhost.
The problem is that if I use any of the php artisan xxx:clear, it gives the same error:
SQLSTATE[HY000] [1698] Access denied for user 'root'#'localhost' ...
So I can I force Laravel 8 to clear the cache (as I guess this is the problem) and read the correct credentials in the .env file?
hey you can use these commands
php artisan config:cache
php artisan config:clear
php artisan cache:clear
thanks :)
The Optimize command still works like champ Try
php artisan optimize
It will clear
Configuration cache
Route cache
Files cache

I got problem when install react js on laravel

i'm trying to install react js on laravel, but when I tried input command "php artisan ui react" it's became error like on the image, have any idea for this case ? thank's
It's done, it happen cause I put js folder on public folder, which should be the js folder must on resource folder
As per laravel requirement for reactjs. You should have to install UI package from composser.
https://laravel.com/docs/7.x/frontend
composer require laravel/ui
after that
php artisan ui react for generating the basic scaffolding.

Laravel Package - artisan vendor publish command not working

I'm new to Laravel, trying to install packages. I've tried many packages to include in my project like AdminLTE and Blogify. as the AdminLTE manual and Blogify manual says exactely.
Installed the packages using composer:
Composer require <package>
I've tried to publish the packages to use:
php artisan vendor:publish
or publish as said in the manuals, but the command gives me output:
Nothing to publish
and public folder doesn't change at all and no folders or files added.
How to integrate these packages into my Laravel 5.2 app in right way?
If possible can some one explain what is the problem and how to get over it and have ability to use it in my blades?
Note: I'm using Windows 10 and XAMP local server,I cant use commands like npm and any thing related to Mac
Step 1: composer require jeroennoten/laravel-adminlte
C:\wamp\blog>composer require jeroennoten/laravel-adminlte
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Using version ^1.6 for jeroennoten/laravel-adminlte
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing jeroennoten/laravel-adminlte (v1.6.5)
Downloading: 100%
Writing lock file
Generating autoload files
> php artisan optimize
Generating optimized class loader
Step 2:Add the service provider to the providers in config/app.php:
Step 3:php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=assets
C:\wamp\blog>php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=assets
Copied Directory [\vendor\jeroennoten\laravel-adminlte\resources\assets] To [\public\vendor\adminlte]
Publishing complete for tag [assets]!

Autoload Vendor with CakePHP 2.x and using class in folder vendor

I have get packpage UPS from page https://github.com/gabrielbull/php-ups-api.
This is save in app/vendor of cakephp 2.x.
How do I use them? T want to import folder of package just download and using many class in it.
It's described, as almost everything else in the official documentation.
Loading Vendor files
But better use composer to manage your packages
Go for composer and it is just a composer require gabrielbull/ups-api and the lib will be available and loaded through the autoloader.

CakePHP question: How can i upgrade a cakephp project from cakephp-1.3.10 to cakephp-1.3.11?

I have developed a project with cakephp-1.3.10 .
Now I want to upgrade it to cakephp-1.3.11.
What's the easiest process to upgrade from cakephp-1.3.10 to cakephp-1.3.11 ?
download the cake zip, unpack, delete the app folder, put your app folder in.
I'm sure you can't use composer! And there's a high cost in upgrading by a large jump between versions, meaning that you will end up with a lot of deprecated code.
I would go like:
complete backup
upload your app to a Github repository
tag your code
create a new branch
upload your new code
debug
merge branch
since you were just upgrading from 1.3.10 to 1.3.11 the simplest way would have been to download latest cakephp and then simply copy lib/ folder from the downloaded folder and replacing it with your existing cakephp/lib/ folder. I would prefer to download latest version from cakephp's official website https://cakephp.org/
Note- If you have to upgrade from 1.x to 3.x then you have to move from 1.x to 2.x and then 2.x to 3.x, direct migration from 1.x to 3.x is not possible

Resources