I'm trying out the PHP micro Framework Lumen (from laravel).
When I set up Lumen and I try to use the php artisan config:cache command like in Laravel, I get this error :
[InvalidArgumentException]
There are no commands defined in the "config" namespace.
So I have problem when I try to deploy the files to server, so I have to change .env file to change the database username and password.
This makes me think config is not available in artisan
How can I add it to artisan ?
Yes, you can not use the php artisan config:cache with your Lumen project, because it is not available out of the box.
You can add it by adding this package (orumad/lumen-config-cache) to your project:
composer require orumad/lumen-config-cache
In lumen you have to add this configuration in bootstrap/app.php file
$app->configure('custom_config_file_name');
#example
$app->configure('custom_emails');
Then you can access like below:
config('filename.key_name');
#example
config('constants.email');
Lumen no need to config:cache.
You do not need to do anything after change .env
Related
I am working in laravel 5 an existing project downloaded from cpanel. I want to make some changes but my changes do not have any affect. I, at the end remove the route but route still working. There is no any extra route file binding in routeServiceProvider not required or included in web.php. I am wondering how it could be happened?
I have tried:
php aritsan cache:clear
php artisan config:clear
can somebody please tell me what could be the issue ?
please run the following:
php artisan route:cache
After running this command, your cached routes file will be loaded on every request.
Please, run the following command:
php artisan route:clear
I have a website based on laravel 5.4. The site is working fine on my localhost. But when I upload it on my shared hosting. It is giving me an error
"at FileViewFinder->findInPaths('welcome', array('C:\\xampp\\htdocs\\lrl\\resources\\views'))"
C:\xampp\htdocs\lrl\resources\views this is my localhost URL. How can I changed this URl. I have made changes in .env file and I put all the files of public folder at root directory. Also I changed Appserviceprovider.php file.
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Schema;
use DB;
use View;
use Request;
I also cleared the cache but still i am getting this error shown in screenshot
run php artisan config:cache
C:\xampp\htdocs\lrl\resources\views is cached in your config file. So, you must clear config cache by run artisan command php artisan config:cache.
Clear you route cache
php artisan route:cache
Clear all if still not work
php artisan config:cache
php artisan config:clear
php artisan view:clear
I just have installed voyager at laravel 5.4 and tables migrated but at the end it shows following error
Route [voyager.posts.index] not defined
As mentioned by #Muhammad Muazzam
1- Run php artisan voyager:install
However, only this didn't work for me, I needed to also
2- Clear php catch: php artisan optimize:clear
Re runing php artisan voyager:install will resolve the issue.
Why the file entrust.php is not created when I run this:
php artisan vendor:publish
I'm following this config and this is my composer.json
"zizaco/entrust": "5.2.x-dev"
"You can also publish the configuration for this package to further customize table names and model namespaces.
Just use php artisan vendor:publish and a entrust.php file will be created in your app/config directory."
But the file entrust.php is not created.
What can I do? This is odd.
In the link you provided they say and, if it does not appear, manually copy the /vendor/zizaco/entrust/src/config/config.php file in your config directory and rename it entrust.php.
just try this
add
"zizaco/entrust": "5.2.x-dev" in composer.json
then composer update.
Then in your config/app.php add
Zizaco\Entrust\EntrustServiceProvider::class,
in the providers array and
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
Next try in your terminal to publish and see in your config
php artisan vendor:publish
--provider="Zizaco\Entrust\EntrustServiceProvider"
check link for how to use zizaco
I solved it by running
php artisan config:cache
Before running
php artisan vendor:publish
run this command
php artisan config:cache
then run
php artisan vendor:publish
I am new to laravel.
I have copied command to create controller from a book and I am trying to run that command:
php artisan Usercontroller:make users
I am getting error:
[InvalidArgumentException]
There are no commands defined in the "Usercontroller" namespace.
Did you mean this?
controller
Current working directory is project directory:
C:\wamp\www\laravel>
There is a typo in commmand,
you should use
php artisan controller:make users
Hope this helps.
Command should be
php artisan controller:make users