artisan

Running Artisan Command from laravel 4.2 Controller

对着背影说爱祢 提交于 2019-12-10 19:35:16
问题 I am trying to execute some custom artisan command from controller like Artisan::call('php artisan MyCustomCommand'); but it works fine when I execute php artisan MuCustomCommand from CLI . I have registered command in app/start/artisan.php. Even Artisan::call('php artisan --help'); is not working. 回答1: You should run artisan command like this from your controller . Example : Artisan::call('migrate:install'); So Instead of doing Artisan::call('php artisan MyCustomCommand'); You should do

Laravel 4.2 artisan CLI does not work anymore after composer update

梦想的初衷 提交于 2019-12-10 18:17:21
问题 I just ran "composer update" on my production server, and received this error: Script php artisan clear-compiled handling the post-update-cmd event returned with an error When I try any "php artisan" commands, I do not receive any results. I have tried deleting my composer.lock file and my vendor folder, and ran "composer install" again, but no results. Here is my composer.json file: { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"],

artisan tinker: mkdir() permission denied

六眼飞鱼酱① 提交于 2019-12-10 13:33:37
问题 Laravel Version 5.0.33 > php artisan tinker [ErrorException] mkdir(): Permission denied This is on a production server, I was trying to test a command with tinker as the web user. This user owns every directory in the base path, so I'm not sure what directory is attempted to be created when I run artisan tinker. 回答1: Using very verbose -vvv , I was able to get a stack trace. Exception trace: () at /data1/vhosts/admin.stewartcoopercoon.com/vendor/psy/psysh/src/Psy/Configuration.php:459

laravel generate database from model

亡梦爱人 提交于 2019-12-10 12:27:04
问题 I am using an existing project of Laravel and this existing project already has models, here is an example of one: <?php /** * Created by Reliese Model. * Date: Fri, 20 Apr 2018 08:56:36 +0000. */ namespace App\Models; use Reliese\Database\Eloquent\Model as Eloquent; /** * Class PdTcountry * * @property int $pkcountry * @property string $country_code * @property string $country_name * @property string $country_localName * @property string $country_webCode * @property string $country_region *

Xdebug laravel artisan commands

偶尔善良 提交于 2019-12-09 18:06:14
问题 I regularly use xdebug to debug applications, I've built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I've written an artisan command to be run via cron to then do something with this data. Xdebug works for accessing the site via the browser, but its not breaking on breakpoints when ran from cli. I run php5-fpm. My files /etc/php5/fpm/php.ini and /etc/php5/cli/php/ini both contain the following settings: zend_extension=/usr

Is there any Laravel way to execute a .SQL file to load data

自古美人都是妖i 提交于 2019-12-09 10:32:24
问题 I have historical data that I want to load in new DB. I could do it by running MySQL command but I am interested to know whether there are artisan commands to do it? 回答1: There isn't a way to import a DB dump out-of-the-box using artisan . However, you could create a custom artisan command: php artisan make:console DbImportCommand and then have it issue a command like: DB::unprepared(file_get_contents('full/path/to/dump.sql')); However, it may be advantageous to create a command that runs a

Laravel: Target is not instantiable while building

一笑奈何 提交于 2019-12-08 11:56:10
问题 Sorry if that question is duplicate, but I've read a lot of related question in StackOverflow but none solved my problem: I created an Artisan command which worked and where I injected a Kafka client service as 1st param and a concrete class, BudgetsTransformer, as the 2nd parameter class ConsumeBudgetsCommand extends Command { public function __construct(FKafka $kafkaClient, BudgetsTransformer $transformer) { $this->kafkaClient = $kafkaClient; $this->transformer = $transformer; parent::_

Getting a List of Artisan Commands Programmatically

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 05:53:44
问题 When you're using the Laravel PHP Framework, is there a way, (at runtime), to programmatically fetch a list of currently configured and available artisan commands? I'm basically looking for way to know All the command names The class or objects that corresponds to that class 回答1: As usual, self help desk strikes as soon as I ask myself the question clearly. //app()->make('artisan')->all(); foreach(Artisan::all() as $key=>$command) { var_dump($key); var_dump(get_class($command)); } 来源: https:/

Laravel scheduler is not running automatically

好久不见. 提交于 2019-12-08 05:42:11
问题 I have made a scheduler. When I call it with php artisan userRanking it works. This is the code in Kernel.php : protected $commands = [ \App\Console\Commands\UserRanking::class, ]; protected function schedule(Schedule $schedule) { $schedule->command('userRanking') ->everyMinute(); } How do I dispatch it so that it runs automatically? 回答1: You have to set up a single cron job that calls the schedule runner every minute: * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1 Read

Laravel Can't Connect to database - Migrations - Error 2002

和自甴很熟 提交于 2019-12-07 16:59:19
问题 I have searched for a couple of hours now, and still am unable to find this. I get 2 errors, if I use the database host as 'localhost' , I get this error: [PDOException] SQLSTATE[HY000] [2002] No such file or directory and if I change the database host to '127.0.0.1' I get this error: [PDOException] SQLSTATE[HY000] [2002] Connection refused Things I have tried: changing where the apache / mysql server is run (either user or `josh (Apache) / josh (MySQL) changing the port that MySQL runs on in