artisan

How to run laravel migrations without artisan (using code)

对着背影说爱祢 提交于 2019-12-06 07:30:33
问题 I recently hosted a laravel project (for a customer) on shared hosting, after failed attempts to get access to the server via ssh I contacted the host who informed me that ssh service was not available for my customers hosting plan, that means I have no access to terminal and can't use artisan. I know how to write a php script that will create sql tables but just before that I was wondering if theres a shortcut to this with laravel since the migrations(tables) are already defined. What I want

Unable to start laravel development server on linux

人走茶凉 提交于 2019-12-06 07:13:38
问题 I am using laravel 5 for my project and everything has been working fine but recently I am facing this problem which I done understand. devboy@devboy-hp ~/sonel_ims_project/ims_eneo $ php artisan serve Laravel development server started on http://localhost:8000/ [Fri Nov 13 12:00:56 2015] Failed to listen on localhost:8000 (reason: Address already in use) I have tried devboy@devboy-hp ~ $ sudo netstat -plnt and get Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address

Write output to console from helper class

岁酱吖の 提交于 2019-12-05 19:24:13
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? I finally figured this out (works in Laravel 5.6) In the handle() function of your SomeCommand class, add $this->myHelper->setConsoleOutput($this->getOutput()); . In your

Laravel 5.6 删除了Artisan Optimize命令

纵饮孤独 提交于 2019-12-05 13:15:01
php artisan optimize 命令在 Laravel 5.5中已经被弃用了。 现在,官方发布了 Laravel 5.6之后已经被移除了。 在Laravel 5.5中,在 post-install-cmd 和 post-update-cmd 中使用 optimize 不在有效了。 现在 用 Laravel 5.6,你不需要使用 optimize 了。 依据 Laravel 5.6 升级指导: 先前弃用的 optimize Artisan命令已被删除。随着包括OPcache在内的PHP本身的最新改进, optimize 命令不再提供任何相关的性能优势。 在 Laravel 5.5 中使用 optimize 命令会生成一个弃用的警告。现在发布 Laravel5.6之后就完全移除了。 所以如果你是正在升级到 Laravel 5.6,确保从 composer.json 文件中移除这个命令。 更多PHP知识,请前往 PHPCasts 来源: oschina 链接: https://my.oschina.net/u/172914/blog/1803003

Execute Laravel/Symfony/Artisan Command in Background

随声附和 提交于 2019-12-05 10:21:46
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 connection is never ending). Going via the command line works fine. Calling the command programatically however

How to use global prefix for tables in Laravel 5

随声附和 提交于 2019-12-05 10:11:49
New in Laravel. Probably a silly question. I had setup database like this: 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '3306'), 'database' => 'mydb', 'username' => 'myusername', 'password' => 'mypassword', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => 'admin', 'strict' => false, 'engine' => null, ], Notice 'prefix' => 'admin' . This is because I want all tables related to the website's control panel be prefixed with admin , e.g: admin_users, admin_log, etc... But I'm stuck at the very beginning. I'm trying to create

laravel create model from custom stub when using php artisan

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 05:54:07
When I use php artisan make:model CustomNamespace\TestModel , I get a model based on default stub as this : namespace App\Models\CustomNamespace; use Illuminate\Database\Eloquent\Model; class TestModel extends Model { // } But what I want to create is a dynamic Model based on my own stub to get something like this: namespace App\Models\CustomNamespace; use App\Models\MyParent; /** * Put a dynamic doc here */ class MyModel extends MyParent { /*put custom methods here*/ } I've checked Laravel docs and other tutos but nothing on this, could you help guys ? Create a new command, extend the

Whoops, looks like something went wrong. Laravel 5.1

你。 提交于 2019-12-05 04:46:24
I have a route like this http://localhost/inspection/show/{id} When I try to load the route at the same time. In different tabs, sometimes some of those tabs has the error "Whoops, looks like something went wrong" Loading in different tabs so fast http://localhost/inspection/show/8 http://localhost/inspection/show/9 http://localhost/inspection/show/10 http://localhost/inspection/show/11 The stack trace have this [2015-08-06 14:57:53] local.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in C:\wamp\www\iaserver\vendor

Overriding Default Laravel database configuration for artisan migrate commands

断了今生、忘了曾经 提交于 2019-12-05 01:33:27
问题 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

Artisan command for clearing all session data in Laravel

强颜欢笑 提交于 2019-12-04 23:11:51
问题 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. 回答1: UPDATE: This question seems to be asked quite often and