artisan

How to use global prefix for tables in Laravel 5

戏子无情 提交于 2019-12-07 06:11:20
问题 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

Laravel 5.2 auth change 'users' table

六眼飞鱼酱① 提交于 2019-12-07 03:56:39
问题 I used the new feature in Laravel: php artisan make:auth But when I register it will use the database table users by default, but I want to change that to an other table. And by default it uses updated_at and created_at in that table, I want to remove that too. Auth/AuthController protected function create(array $data) { return User::create([ 'voornaam' => $data['voornaam'], 'email' => $data['email'], 'password' => bcrypt($data['password']), ]); } app\User protected $fillable = [ 'voornaam',

Lumen php artisan config:cache not found

非 Y 不嫁゛ 提交于 2019-12-07 01:33:55
问题 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 ? 回答1: Yes, you can not

laravel create model from custom stub when using php artisan

↘锁芯ラ 提交于 2019-12-07 01:32:45
问题 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

Laravel scheduler is not running automatically

谁说我不能喝 提交于 2019-12-06 22:20:25
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? 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's Scheduler docs for more info. 来源: https://stackoverflow.com/questions/31993033/laravel-scheduler-is-not

Using verbose in Laravel artisan commands

大憨熊 提交于 2019-12-06 19:02:49
问题 Is there a way to detect what verbosity level the user has specified when creating a custom artisan command? I don't see anything about it in the docs. 回答1: There's the getVerbosity() function in Symfony\Component\Console\Output\OutputInterface and you can use $this->getOutput() to retrieve the output object. $verbosityLevel = $this->getOutput()->getVerbosity(); You then can compare the level to the constants defined inside OutputInterface . For example: if($verbosityLevel >= OutputInterface:

Install LARAVEL 5 Locally Same as Share Hosting Directory (Deploy L5 Share Hosting Solution)

别等时光非礼了梦想. 提交于 2019-12-06 16:00:05
问题 I am trying to find the way to organise my Laravel Application same as share hosting directory. Example inside " server " folder 1.Install fresh laravel application composer create-project laravel/laravel main-app --prefer-dist 2.Move "Public" directory up and next to main-app folder.Rename to public_html 3.Inside public_html folder also create new "app" folder to keep all the files like inside index.php Summary server │ └───main-app │ │ app │ │ bootstrap │ │ ...... │ └───public_html │ app │

Getting a List of Artisan Commands Programmatically

两盒软妹~` 提交于 2019-12-06 14:39:34
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 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://stackoverflow.com/questions/27279294/getting-a-list-of-artisan-commands-programmatically

Cannot make command line tool for artisan in PHPStorm 10.0.1

浪尽此生 提交于 2019-12-06 11:20:15
问题 I got this error message when I tried to make an alias for artisan: [Settings | Tools | Command Line Tool Support ] -> add -> tool based on Symfony Console Problem Failed to parse output as xml: Error on line 4: Content is not allowed in prolog.. Command C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --xml Output [Symfony\Component\Console\Exception\RuntimeException] The "--xml" option does not exist. Ok, I know, what's the problem but I don't find any solution for this. Thank you

Laravel 5: run migrations on server environment, not local

一个人想着一个人 提交于 2019-12-06 09:32:22
问题 I have a simple set of database migrations created within my Laravel 5 application, and they run nicely on my local development environment. Now its time to run to run the migration on my new production server environment. I have configured the DB connection and deployed the app, and the app sees the database, but there are no tables - so migrations need to be run. The following command, I believe, should run the migrations using the "production" environment, which is set up with the remote