artisan

Overriding Default Laravel database configuration for artisan migrate commands

半世苍凉 提交于 2019-12-03 17:28:40
For my database (MySQL), I have two user accounts, one ( mydbuser ) for general application access with select/inset/update/delete permissions on all tables, the other ( mydbadmin ) with privilege to manage tables, etc CREATE USER 'mydbadmin'@'%' IDENTIFIED BY 'ultrasecret password'; GRANT ALL ON mydb.* TO 'mydbadmin'@'%'; CREATE USER 'mydbuser'@'%' IDENTIFIED BY 'not quite so secure password'; GRANT SELECT, INSERT, UPDATE, DELETE ON mydb.* TO 'mydbuser'@'%'; My Laravel app is configured to use the mydbuser user, while mydbadmin is currently used for manually setting up the tables, etc. Now, I

Artisan command for clearing all session data in Laravel

拟墨画扇 提交于 2019-12-03 15:05:33
What is the artisan command for clearing all session data in Laravel, I'm looking for something like: $ php artisan session:clear But apparently it does not exist. How would I clear it from command line? I tried using $ php artisan tinker ... \Session::flush(); But it flushes session of only one user, I want to flush all sessions for all users. How can I do it? I tried this: artisan cache:clear But it does not clear session, again. UPDATE: This question seems to be asked quite often and many people are still actively commenting on it. In practice, it is a horrible idea to flush sessions using

Artisan command says : Dotenv values containing spaces must be surrounded by quotes

为君一笑 提交于 2019-12-03 14:56:35
问题 I'm trying to know the list of artisan command by using php artisan list . and the command return me the following error [Dotenv\Exception\InvalidFileException] Dotenv values containing spaces must be surrounded by quotes. What is wrong? Thanks in advance. 回答1: You should remove all spaces from .env file to make an app work again. If you have to use spaces, instead of this: VAR=some data Use quotes: VAR="some data" 回答2: Verify your .env file. You need to check for the following: Any extra or

Running multiple Laravel queue workers using Supervisor

佐手、 提交于 2019-12-03 14:43:33
I using Laravel queues using a database driver and supervisor to keep a queue worker running all the time: [program:laravel_queue] command=php artisan queue:listen --timeout=1800 --tries=5 directory=/var/app/current stdout_logfile=/var/app/support/logs/laravel-queue.log logfile_maxbytes=0 logfile_backups=0 redirect_stderr=true autostart=true autorestart=true startretries=86400 EOB Some of the queue tasks can take around 10 minutes to complete. I have 2 parts to the question: 1) How can i edit the above script to run multiple (e.g. 3) queue workers on the same queue. 2) Is there a way of

How to fix in laravel 5.2 zizaco entrust:migration class name validation?

本秂侑毒 提交于 2019-12-03 11:58:53
问题 I have followed zizac/entrust installation tutorial from GitHub Link and faced with error: Class name must be a valid object or a string in var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86 MigrationCommand.php file url : Link Outut: php artisan entrust:migration Tables: roles, role_user, permissions, permission_role A migration that creates 'roles', 'role_user', 'permissions', 'permission_role' tables will be created in database/migrations directory

Laravel 5.3 storage:link -> symlink(): Protocol error

非 Y 不嫁゛ 提交于 2019-12-03 11:25:04
问题 I'm trying to run the following artisan command: php artisan storage:link I get this error: [ErrorException] symlink(): Protocol error Can you help me to solve this. This is my setup: Windows 10 using vagrant with Homestead (v0.5.0) box Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64) Laravel Framework version 5.3.6 PHP 7.0 回答1: Your problem probably is that you have to start your vagrant box as a system administrator. So hit start type "cmd", right click it choose "Run as administrator".

Laravel php artisan db:seed leads to “use” statement error

≡放荡痞女 提交于 2019-12-03 09:46:28
When I try to run php artisan db:seed I get the following error: The use statement with non-compound name 'DB' has no effect I have written my own seeder file which I have included below, based on a snippet from the doc . As you can see I am using the use DB shortcut - is this what the problem is? <?php use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; use DB; class ClassesTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { DB::table('classes')->delete(); DB::table('classes')->insert([ 'class_name' => 'Test course 111',

Artisan, creating tables in database

五迷三道 提交于 2019-12-03 06:40:33
问题 I am trying to create mysql tables in Laravel 5. I created a file in /project/database/migrations called users.php : [...] public function up() { Schema::create('users', function(Blueprint $table) { $table->increments('id'); $table->string('username'); $table->string('fullname'); $table->int('number'); $table->string('email')->unique(); $table->string('password', 60); $table->rememberToken(); $table->timestamps(); }); } [...] I then tried running these commands in the project -folder: $ php

Laravel 5.4 - php artisan cache:clear does not clear cache files when using 'file' cache driver

為{幸葍}努か 提交于 2019-12-03 05:38:46
Laravel 5.4 app. CACHE_DRIVER is set to file and QUEUE_DRIVER is set to sync in .env . When I run php artisan cache:clear It says Cache cleared successfully yet I still have 236K of files in my storage/framework/cache directory. Frustrated by this, I also manually deleted all files/directories under storage/framework/cache using rm -rf * from that directory. Now, when I run art queue:restart I get [ErrorException] file_put_contents(/var/www/vhosts/my-app.com/releases/28/storage/framework/cache/ee/2f/ee2f842aa7bb1f53ed f3a2ed2c09a1807ffa6c90): failed to open stream: No such file or directory So

Artisan command says : Dotenv values containing spaces must be surrounded by quotes

倖福魔咒の 提交于 2019-12-03 04:40:06
I'm trying to know the list of artisan command by using php artisan list . and the command return me the following error [Dotenv\Exception\InvalidFileException] Dotenv values containing spaces must be surrounded by quotes. What is wrong? Thanks in advance. You should remove all spaces from .env file to make an app work again. If you have to use spaces, instead of this: VAR=some data Use quotes: VAR="some data" Verify your .env file. You need to check for the following: Any extra or non-needed spaces If you have any strings with spaces, make sure to surround them in quotes Example: varaible=123