artisan

Laravel - only home route working

試著忘記壹切 提交于 2019-12-24 09:29:33
问题 the problem all routes are typed correctly and checked by php artisan route:list here the output +--------+----------+------+--------+------------------------------------------- -------+------------+ |←[32m Domain ←[39m|←[32m Method ←[39m|←[32m URI ←[39m|←[32m Name ←[39m|←[3 2m Action ←[39m|←[32m Middleware ←[39m | +--------+----------+------+--------+------------------------------------------- -------+------------+ | | GET|HEAD | / | home | App\Http\Controllers\QuoteController@getIn dex |

Laravel Artisan Hangs using Memory Until Freeze

情到浓时终转凉″ 提交于 2019-12-24 06:48:32
问题 With Laravel 5.4 Artisan will not run and uses a lot of memory, it worked a long while before with the same versions (besides PHP 7.0.14 to 7.0.15 maybe?). Problem : any $ ./artistan command does nothing. While watching htop I notice the memory climb from 2gb to 4gb very quickly. Once I cancel it, it jumps back down. What Im Using Ubuntu Linux Xenial x64 (Local Development) Apache2.4 MySQL 5.7 PHP 7.0.15 Laravel 5.4 Composer 1.3.2 PHP Extensions Loaded [PHP Modules] bz2 Core ctype curl date

How to get the current console command in Laravel

∥☆過路亽.° 提交于 2019-12-23 12:38:25
问题 I can see if a script is running in the console with the App::runningInConsole() command, but I would like to know (for audit logging purposes) which command has been run from console. To add some context - I need to log whenever a system or user accesses a certain type of data. For users, that's pretty simple - I can use Auth::user() and get their IP address from Request , but for console commands, it's a little more difficult. I can figure out if a console command is running, which is good,

How to neatly handle Exceptions in Artisan Commands

南笙酒味 提交于 2019-12-23 10:47:08
问题 Using Lumen to create an API - love Laravel but all the View's that come with it were overkill for the project I am creating. Anyway, I've made a series of Commands which go out and collect data and stores it to the database. <?php namespace App\Console\Commands; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption; use App\User; class GetItems extends Command { /** * The console command name. * * @var string */ protected $name = 'GetItems'; /** * The console

How to save/redirect output from Laravel 5 Artisan command?

浪子不回头ぞ 提交于 2019-12-23 07:50:04
问题 I have tried the method described here but this doesn't work on my Laravel 5 installation. use Symfony\Component\Console\Output\BufferedOutput; Route::get('/test', function() { $output = new BufferedOutput; Artisan::call('testCommand', array(), $output); return $output->fetch(); }); My command; public function fire() { $this->info('No output visible'); } Any suggestions what I might do wrong? Or is it something that has changed in Laravel 5? 回答1: I managed to get this to work using Artisan:

Write output to console from helper class

自古美人都是妖i 提交于 2019-12-22 11:08:06
问题 I have a console command that runs a helper class and I want to write output with $this->info() to the console from the helper class. My code looks like this: App/Http/Console/Commands/SomeCommand.php function handle(Helper $helper) { return $helper->somefunction(); } App/Http/SomeHelper.php function somefunction() { //some code $this->info('send to console'); } Is there any way to write the output to console from the helper? 回答1: I finally figured this out (works in Laravel 5.6) In the

Execute Laravel/Symfony/Artisan Command in Background

依然范特西╮ 提交于 2019-12-22 07:09:12
问题 I need to execute a Laravel long running process in the background for consuming the Twitter Streaming API. Effectively the php artisan CLI command I need to run is nohup php artisan startStreaming > /dev/null 2>&1 & If I run that myself in the command line it works perfectly. The idea is that I can click a button on the website which kicks off the stream by executing the long running artisan command which starts streaming (needs to run in the background because the Twitter Streaming

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

丶灬走出姿态 提交于 2019-12-20 18:15:23
问题 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

Laravel 5 - Php artisan syntax error

☆樱花仙子☆ 提交于 2019-12-20 17:35:43
问题 I am currently developing an app with Laravel 5 and suddenly the artisan stoped working! I can't use a single command on it, it always return the error: [Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected ',', expecting variable (T_VARIABLE) I tried to update via composer but when the artisan tries to clear-complie Command: composer update > php artisan clear-compiled [Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected ',', expecting

Laravel 5 - Creating Artisan Command for Packages

筅森魡賤 提交于 2019-12-20 11:44:08
问题 I have been following along http://laravel.com/docs/5.0/commands and able to create artisan command in Laravel 5. But, how can I create artisan command and package it to packages? 回答1: You can and should register the package commands inside a service provider using $this->commands() in the register() method: namespace Vendor\Package; class MyServiceProvider extends ServiceProvider { protected $commands = [ 'Vendor\Package\Commands\MyCommand', 'Vendor\Package\Commands\FooCommand', 'Vendor