Giter Site home page Giter Site logo

codestudiohq / laravel-totem Goto Github PK

View Code? Open in Web Editor NEW
1.8K 37.0 223.0 12.12 MB

Manage Your Laravel Schedule From A Web Dashboard

License: MIT License

PHP 70.31% Vue 10.34% Blade 18.89% Dockerfile 0.46%
laravel cron-jobs scheduling package dashboard cron laravel-schedule hacktoberfest artisan-commands laravel-totem

laravel-totem's Introduction

Laravel Totem

Build Status License

Introduction

Join the chat at https://gitter.im/laravel-totem/Lobby

Manage your Laravel Schedule from a pretty dashboard. Schedule your Laravel Console Commands to your liking. Enable/Disable scheduled tasks on the fly without going back to your code again.

Documentation

Compatiblity Matrix

Laravel Totem
11.x 11.x
10.x 10.x
9.x 9.x
8.x 8.x
7.x 7.x
6.x 6.x
5.8 5.x
5.7 4.x
5.6 3.x
5.5 2.x
5.4 1.x

Installing

Totem requires Laravel v5.4 and above, please refer to the above table for compatability. Use composer to install totem to your Laravel project

composer require studio/laravel-totem

Laravel Totem supports auto package discovery for Laravel v5.5+, therefore service provider registration is not required in Laravel v5.5+

Add TotemServiceProvider to the providers array of your Laravel v5.4 application's config/app.php

Studio\Totem\Providers\TotemServiceProvider::class,

Once Laravel Totem is installed & registered,

  • Run the migration
php artisan migrate
  • Publish Totem assets to your public folder using the following command
php artisan totem:assets
Table Prefix

Totems' tables use generic names which may conflict with existing tables in a project. To alleviate this the .env param TOTEM_TABLE_PREFIX can be set which will apply a prefix to all of Totems tables and their models.

Updating

Please republish totem assets after updating totem to a new version

php artisan totem:assets

Configuration

Cron Job

This package assumes that you have a good understanding of Laravel's Task Scheduling and Laravel Console Commands. Before any of this works please make sure you have a cron running as follows:

* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
Web Dashboard

Laravel Totem's dashboard is inspired by Laravel Horizon. Just like Horizon you can configure authentication to Totem's dashboard. Add the following to the boot method of your AppServiceProvider or wherever you might seem fit.

use Studio\Totem\Totem;

Totem::auth(function($request) {
    // return true / false . For e.g.
    return Auth::check();
});

By default Totem's dashboard only works in local environment. To view the dashboard point your browser to /totem of your app. For e.g. laravel.dev/totem.

Filter Commands Dropdown

By default Totem outputs all Artisan commands on the Create/Edit tasks. To make this dropdown more concise there is a filter config feature that can be set in the totem.php config file.

Example filters

'artisan' => [
    'command_filter' => [
        'stats:*',
        'email:daily-reports'
    ],
],

This feature uses fnmatch syntax to filter displayed commands. stats:* will match all Artisan commands that start with stats: while email:daily-reports will only match the command named email:daily-reports.

This filter can be used as either a whitelist or a blacklist. By default it acts as a whitelist but an option flag can be set to instead act as a blacklist.

'artisan' => [
    'command_filter' => [
        'stats:*',
        'email:daily-reports'
    ],
    'whitelist' => true,
],

If the value of whitelist is false then the filter acts as a blacklist.

'whitelist' => false

Middleware

Laravel Totem uses the default web and api middleware but if customization is required the middleware can be changed by setting the appropriate .env value. These values can be found in config/totem.php.

Making Commands available in Laravel Totem

All artisan commands can be scheduled. If you want to hide a command from Totem make sure you have the hidden attribute set to true in your command. For e.g.

protected $hidden = true;

From L5.5 onwards all commands are auto registered, so this wouldn't be a problem.

Command Parameters

If your command requires arguments or options please use the optional command parameters field. You can provide parameters to your command as a string in the following manner

name=john.doe --greetings='Welcome to the new world'

In the example above, name is an argument while greetings is an option

Console Command

In addition to the dashboard, Totem provides an artisan command to view a list of scheduled task.

php artisan schedule:list

Screenshots

Task List

Task List

Task Details

Task List

Edit Task

Task List

Artisan Command to view scheduled tasks

Task List

Changelog

Important versions listed below. Refer to the Changelog for a full history of the project.

Credits

Bug reports, feature requests, and pull requests can be submitted by following our Contribution Guide.

Contributing & Protocols

License

This software is released under the MIT License.

© 2020 Roshan Gautam, All rights reserved.

laravel-totem's People

Contributors

arkanius avatar b-roberts avatar bondas83 avatar carusogabriel avatar chenruihua avatar crazyboy49z avatar daniel-g-wood avatar dexmans avatar dylanmslavin avatar gitter-badger avatar jayjfletcher avatar jonah-dev avatar jonnott avatar jorgemudry avatar jpscharf avatar kusnir avatar locnguyen1842 avatar lroggen avatar marcoocram avatar matthewnessworthy avatar mesuterdemir avatar o-kima avatar pierot avatar qschmick avatar roshangautam avatar shawnheide avatar solflare avatar superbiche avatar timothyasp avatar tomschlick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-totem's Issues

Import throws sql error when importing frequencies

Reproduce: Create a task with a frequency, export it (json looks good), import it.

Following error occurs: An error occurred while importing data.SQLSTATE[HY000]: General error: 1364 Field 'task_id' doesn't have a default value (SQL: insert into `task_frequencies` (`label`, `interval`, `updated_at`, `created_at`) values (Every Ten Minutes, everyTenMinutes, 2018-05-03 11:29:30, 2018-05-03 11:29:30))

I would assume it should work, but it looks like the createOrUpdate is not working as expected for creating new ones.

totem_tasks.json.gz

What happens to regular scheduled tasks?

Hi.
I was a bit confused about the scope of this package. It wasn't clear to me that it would completely take over my schedule, and ignore scheduled tasks defined in app/Console/Kernel.php.

Not working with Spatie HTML package

This is what I get when I open the totem page-

Method Spatie\Html\Html::columnSort does not exist. (View: project\vendor\studio\laravel-totem\resources\views\tasks\index.blade.php)

I am using Spatie HTML package. Is there any way I can get a workaround for this?

Error when deleteing task

Laravel: 5.6 (fresh install),
Server: Debian 8, Nginx 1.12 , PHP 7.1, composer 1.6.3
Totem Table Prefix: totem_
Queue Driver: redis
Queue Monitor: Laravel Horizon

Task creating, executing is all working well, however when deleting a Task, it disappears from Totem dashboard, but the Deleted item in the Queue fails.

image

Full error log:

Studio\Totem\Events\Deleted
ID: 76535
Queue: {development}
Tags: Studio\Totem\Task:66
Failed At: 18-04-11 13:54:02

Error
Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [Studio\Totem\Task]. in /var/www/public/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:416
Stack trace:
#0 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(85): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(55): Studio\Totem\Events\Event->restoreModel(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(45): Studio\Totem\Events\Event->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#3 [internal function]: Studio\Totem\Events\Event->__wakeup()
#4 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(42): unserialize('O:38:"Illuminat...')
#5 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#6 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(322): Illuminate\Queue\Jobs\Job->fire()
#7 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(272): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#8 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#9 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('redis', '{development}', Object(Illuminate\Queue\WorkerOptions))
#10 /var/www/public/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('redis', '{development}')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#12 /var/www/public/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#13 /var/www/public/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 /var/www/public/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#15 /var/www/public/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#16 /var/www/public/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#17 /var/www/public/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 /var/www/public/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#19 /var/www/public/vendor/symfony/console/Application.php(865): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/public/vendor/symfony/console/Application.php(241): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Horizon\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/public/vendor/symfony/console/Application.php(143): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/public/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/public/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/public/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main}

The deleted task continues to try and execute because it doesn't recognised that it's been deleted.

image

Same error log as above.

[TESTS] SQLite can't run migrations of totem

Laravel has some problem with various itens in down method of migrations. One example of it is when you're trying to run tests in memory with SQLite.

I know that's really strange; but, I just installed Totem and all my tests stop passing accusing the same migration problem:

"Caused by Doctrine\DBAL\Driver\PDOException: SQLSTATE[HY000]: General error: 1 no such
column: notification_phone_number"

The reason of it is because the down method of migration alter_tasks_table_add_notifications_fields has many drop options in a unique schema.

A possible fix is to separe it in "n" schemas, like:

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_phone_number');
    });

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_slack_webhook');
    });`

instead of:

    Schema::table('tasks', function (Blueprint $table) {
        $table->dropColumn('notification_phone_number');
        $table->dropColumn('notification_slack_webhook');
    });

Again, I know that it's strange, but, is a solution provided by own Taylor (laravel/framework#2979)

"Class 'Form' not found"

Class 'Form' not found (View: C:\laragon\www\blog\vendor\studio\laravel-totem\resources\views\tasks\index.blade.php)

i get it for first time i've installed

[Proposal] Implement the search field in task list page

Right now the search field in the index page has not been implemented yet.

Also I think disable/enable buttons in the list page might be useful. Right now they are in the detail page, but I think it would be a little bit inconvenient.

What do you think?

Totem not running task. But running Kernel Tasks.

My tasks run when I execute them directly on the the dashboard but on when they are scheduled. But the scheduled command on Kernel they are running instead.

I am running php 7.2
Laravel 5.6.*
Totem 3.2

[BUG] Removing the console instruction.

@qschmick and @roshangautam In the Overriding multiples arguments correction, the console statement was removed, creating a bug for my application ... please go back with the console check.

We have to be careful about removing validations.

return count($param) > 1 ? [$param[0] => $param[1]]

CORRECT IS:

public function compileParameters($console = false)
    {
        if ($this->parameters) {
            $regex = '/(?=\S)[^\'"\s]*(?:\'[^\']*\'[^\'"\s]*|"[^"]*"[^\'"\s]*)*/';
            preg_match_all($regex, $this->parameters, $matches, PREG_SET_ORDER, 0);

            $argument_index = 0;
            $parameters = collect($matches)->mapWithKeys(function ($parameter) use ($console, &$argument_index) {
                $param = explode('=', $parameter[0]);

                return count($param) > 1 ?
                    ($console ? ((starts_with($param[0], '--') ? [$param[0] => $param[1]] : [$argument_index++ => $param[1]])) : [$param[0] => $param[1]])
                    : (starts_with($param[0], '--') && !$console ? [$param[0] => true] : $param);

            })->toArray();

            return $parameters;
        }

        return [];
    }

Import Form has different action than used route

According to artisan route:list the allowed methods for task/import are GET and HEAD but the form uses POST. Is there reasoning for this? If so please let me know otherwise i will bring up a PR for this later.

Custom commands not showing

Hi, loving the idea of this package so wanted to give it a go.

We've got around 15 custom commands which are registered in the Console/Kernel.php and we run via the normal laravel scheduler.

However none of these commands are showing on the Totem create task screen.

Is there something we need to do to make these show?

Thanks

Cron Job not running totem commands

I am running Laravel 5.5
I have a cron job set to run every min at:
php /complete/path/to/app/artisan schedule:run >/dev/null 2>&1

It only runs commands set in the app/console/kernel.php
I can test this with the inspire command, and it works fine but never runs the tasks in totem.

When I run php artisan schedule:run via ssh, it runs the tasks set in totem as well as in kernel.php.
Php artisan schedule:list also returns totem tasks and kernel tasks.
Totem tasks view does not display tasks listed in kernel.

When I remove all kernel tasks, the cron job simply displays this:
No scheduled commands are ready to run.

All tasks are set to run every min. I need my totem tasks to run every min! Any ideas what I am doing wrong?

I am just using simple tasks such as inspire and command list for testing.

Undefined variable: errors

Undefined variable: errors (View: D:\web projects\marketing\server\vendor\studio\laravel-totem\resources\views\tasks\index.blade.php)

please help how to solve this problem

Command never gets to executes

Laravel: 5.5 (not fresh install),
Server: Debian 8, Nginx 1.12 , PHP 7.1, composer 1.6.3
Totem Table Prefix: totem_

I'm running the queue worked manually just for testing: php artisan queue:work

When creating a task in Totem, I notice the queue worker log outputting this continuously:

[2018-02-21 12:22:19] Processing: Studio\Totem\Events\Creating
[2018-02-21 12:22:19] Processing: Studio\Totem\Events\Created
[2018-02-21 12:22:19] Processing: Studio\Totem\Events\Creating
[2018-02-21 12:22:19] Processing: Studio\Totem\Events\Created
[2018-02-21 12:22:19] Processing: Studio\Totem\Events\Creating
....
....

The job never executes even though I do have a cron running:

* * * * * php /var/www/development.mydomain.co.uk/current/artisan schedule:run >> /dev/null 2>&1

When I delete the task, the following exception shows in the failed_jobs table:

payload

{
    "displayName": "Studio\\Totem\\Events\\Created",
    "job": "Illuminate\\Queue\\CallQueuedHandler@call",
    "maxTries": null,
    "timeout": null,
    "timeoutAt": null,
    "data":
    {
        "commandName": "Illuminate\\Broadcasting\\BroadcastEvent",
        "command": "O:38:\"Illuminate\\Broadcasting\\BroadcastEvent\":7:{s:5:\"event\";O:27:\"Studio\\Totem\\Events\\Created\":2:{s:4:\"task\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":3:{s:5:\"class\";s:17:\"Studio\\Totem\\Task\";s:2:\"id\";i:13;s:10:\"connection\";s:11:\"development\";}s:6:\"socket\";N;}s:10:\"connection\";N;s:5:\"queue\";N;s:15:\"chainConnection\";N;s:10:\"chainQueue\";N;s:5:\"delay\";N;s:7:\"chained\";a:0:{}}"
    }
}

exception

Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [Studio\Totem\Task]. in /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:412
Stack trace:
#0 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(54): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(41): Studio\Totem\Events\Event->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 [internal function]: Studio\Totem\Events\Event->__wakeup()
#3 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(42): unserialize('O:38:"Illuminat...')
#4 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(76): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#5 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(320): Illuminate\Queue\Jobs\Job->fire()
#6 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(270): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#7 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(114): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#8 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#9 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#10 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#11 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#12 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#13 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#16 /var/www/development.mydomain.co.uk/releases/24/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#17 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 /var/www/development.mydomain.co.uk/releases/24/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/development.mydomain.co.uk/releases/24/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/development.mydomain.co.uk/releases/24/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/development.mydomain.co.uk/releases/24/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/development.mydomain.co.uk/releases/24/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}

Improve "Illuminate\Console\Scheduling\Schedule" configuration

Right now in the \Studio\Totem\Providers\ConsoleServiceProvider::register method the booted event is being listened and then app is run in console, then new schedules are added into application.

Proposing to simplify this by:

  1. using \Studio\Totem\Providers\ConsoleServiceProvider::boot method instead of \Studio\Totem\Providers\ConsoleServiceProvider::register method
  2. do the $this->app->resolving(Illuminate\Console\Scheduling\Schedule::class, function (...
  3. don't check for console

This way whoever wants the schedule class would get it with all schedules already added.

Not sure though how this thing could be tested or if resolving events are triggered in unit tests.

Install package error

I have issues while installing your package with composer.
The service provider checks whether the totem table exists. However, an .env file doesn't exist on this stage. It has to be generated after the composer installation process. This means Laravel has no database connection.

Spell mistake in whitelist

It's an easy one.
On Tetem.php 'whitelist' is spelled as 'whiltelist'
I tried to create a pull request but got confused on which branch to keep pull request, 2.0 or 3.0

[BUG] Schedule page and console list desync

In our environment, none of our tasks are getting executed anymore. On the page, we have tasks (just a sample of our tasks):

image

But notice that the only task that appears to be executing anymore is the Download TV Guide. Which was one of the first tasks added to the system. Most of our tasks look exactly the same: 8/31 was their last execution. Even though they have upcoming scheduled times. This includes tasks that are supposed to run every minute.

However, the console command:
image

Lists nothing.

This morning, I ran a composer update to see if it would fix the problem, and no issues with the update. But tasks still aren't running. I checked my crontab:

* * * * * * php /var/www/html/scheduler/artisan schedule:run >> /var/www/html/scheduler/storage/logs/schedule_runs.log 2>&1

Which writes to a log file so we can make sure everything is running. And the scheduled task runs.

Any of the tasks on the page can be run manually by hitting the play button.

Syntax errors

While attempting to add the package to my project I received these issues.
unexpected '->' (T_OBJECT_OPERATOR) AND syntax error, unexpected '('.

Steps taken:

  • Ran composer require studio/laravel-totem
  • Added Studio\Totem\Providers\TotemServiceProvider::class, to app/config.php
  • Attempted to run artisan migrate
vagrant@vagrant-ubuntu-trusty-64:/code/$ php artisan migrate
PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) in code/vendor/studio/laravel-totem/src/Console/Commands/ListSchedule.php on line 86

[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected '->' (T_OBJECT_OPERATOR)

Line causing error:
return (CronExpression::factory($event->expression)->getNextRunDate($date->toDateTimeString()))->format('Y-m-d H:i:s');
Specifically it is the -> going to the format() function.

Commenting out this line allows for the migration to run and for the assets to be published. After adding the Totem::auth() to AppServiceProvider a new error arises from tinker or when viewing a route.

vagrant@vagrant-ubuntu-trusty-64:/code/$ php artisan schedule:list
PHP Parse error:  syntax error, unexpected '(' in /code/vendor/studio/laravel-totem/src/Totem.php on line 26                                                           

[Symfony\Component\Debug\Exception\FatalErrorException]  
syntax error, unexpected '('

Line causing error:

return (static::$authUsing ?: function () {
    return app()->environment('local');
})($request);

Removing ($request) also removes the error.

Environmental setup:

  • Ubuntu 14.04.5 LTS
  • PHP 5.6.30
  • Laravel 5.4.24

cron job not running?

I have installed the Totem package and added both a cronjob and a task in Totem to run the scheduled commands in Kernel.php. Both have a frequency of every minute.
The cron job that I added to the crontab (using "crontab -e") is running just fine but nothing is showing up in Totem, and no task results are added in my database.

Am I doing something wrong?

I'm using Laravel 5.5 and Homestead

Error when viewing tasks

Not sure what could be the issue and I've exhausted myself so here I am :)

When trying to view a task in Totem, I get the following error:

Trying to get property of non-object (View: /home/vagrant/Code/comiccartel/vendor/studio/laravel-totem/resources/views/tasks/view.blade.php)

Here's the stack trace:

<?php $__env->startSection('title'); ?>
    <div class="uk-flex uk-flex-between uk-flex-middle">
        <h5 class="uk-card-title uk-margin-remove">Task Details</h5>
        <status-button :data-task="<?php echo e($task); ?>" :data-exists="<?php echo e($task->exists ? 'true' : 'false'); ?>" activate-url="<?php echo e(route('totem.task.activate')); ?>" deactivate-url="<?php echo e(route('totem.task.deactivate', $task)); ?>"></status-button>
    </div>
<?php $__env->stopSection(); ?>

Happens in production and in local but only on this particular project. Any ideas on what could be causing it?

For context: I'm on Forge, using Digital Ocean, PHP7.1, and Redis. And like I said, it works on other projects with the same set up, but not this one.

command filter and easy import/export

I just took my first look at your package. Great work on the UI and the level of customizability!

I think it would be nice to have an easy means of importing and exporting lists of scheduled commands. Otherwise it seems a bit awkward to design all your schedules on dev and then port them over to production. This is normally very straightforward when commands are committed to code but not so clear with your package. Yes you could use seeders.. or you could dump the 4 tables manually.. but it would be nice if this was built-in to the package

My 2nd suggestion is having some kind of "command filter" in a config file. Right now the drop-down includes all detected commands which in my app's case is a huge list of 70+ commands.. 95% of which would never be scheduled. It would be nice if there was an optional array of command filters in a totem.php config file where I could use wildcards for example:

return [
    'command-filters' => [
        'backup:*',
        'custom:*'
        'some:command'
    ],
]

Can't Pass Single Command Parameter Without a Value

I have a command that takes a single parameter. Example:

php artisan check-prices --only-simple

This seems to cause a problem for Totem because when it eventually gets passed to Artisan::call it needs to be passed as a key/value array like this:

["--only-simple" => true]

Currently it seems to pass like this:

["--only-simple"]

This results in this error:

The "1" argument does not exist.

I see the code in compileParameters expects all parameters to have values (via the explode call here). Is there any reason not to allow parameters without values?

Run schedule

Execute schedule every 1 minutes but only one run. I want to run every 1 minute every time I make click execute schedule.
How to implement it?

[Question] Is there a way to clear the Totem task list from the command line?

So I set up Totem on a project and when trying to create or edit tasks, it through errors. Eventually, my solution was to go in the database and truncate the Totem tables to get a fresh start.

However, when I run artisan schedule:list, I see the jobs that I had added that I need to remove. Since they are no longer listed in the web interface, I seem to have no way to clear them from the system.

How would I remove these jobs so they stop firing?

Failing to Migrate Tables

TL;DR - The Solution:
In the src/Providers/TotemServiceProvider.php class, this code:
$this->mergeConfigFrom( __DIR__.'/../../config/totem.php', 'totem' );
needs to precede the try/catch responsible for registering the ConsoleServiceProvider.
And the check for the table within the 'try' needs to read:
if (Schema::hasTable(config('totem.table_prefix', '').'tasks')) {
instead of:
if (Schema::hasTable('tasks')) {


Details:

If you happen to have a table called "tasks" that's in no way related to Totem, and you're leveraging the TOTEM_TABLE_PREFIX environment variable, and you haven't yet run the migrations associate with this package, you'll get an error whenever you try to do virtually anything. It'll be an SQL error siting the fact that it can't find your totem table.

The TotemServiceProvider does have the ability to automatically run the necessary migrations. The problem is, it sets this action to wait for Laravel to make sure the "migrator" is actually spun up first. And in the meantime, it moves on to initiating the ConsoleServiceProvider, which expects those tables to already exist.

There is a check designed to prevent this conflict, but it's not behaving quite right. Whether or not the ConsoleServiceProvider gets registered depends on whether you have a table called "tasks" in your DB schema already. That check is not respecting the "totem.table_prefix" value that's contingent on the TOTEM_TABLE_PREFIX environment variable.

In addition, if this condition is not met, then I'm not sure the ConsoleServiceProvider will ever get the opportunity to be registered until the app is restarted, after the run that triggered the migrations.

[BUG] overriding multiples arguments;

Creating at new task: in the field "PARAMETERS (OPTIONAL)" I insert the following information for a custom command that can accept multiple arguments: "seaport=15 typetraffic=05"
When i click Execute (to force execution) it works, because it don't use the console. However, when using the console (Laravel's schedule), it errors.
I took the liberty to debug the code and found a problem in the file Task.php, method compileParameters.
The problem happens because when running on console it doesn't pass named parameters, and in the mentioned method it will override the first parameter with the second as both will have the key 0.
Following is a Print of a fix.

Please inform me if there is another solution.

Beautiful theme

I loved the UIKit theme used for this package. Any way to release it separately from laravel-totem?

Cannot add foreign key constraint

Hello, I've been getting Cannot add foreign key constraint when running php artisan migrate since the update to 3.2.4.

My table_prefix = totem_

 Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `totem_task_results` add constraint `task_id_fk` foreign key (`task_id`) references `tasks` (`id`))

  at C:\Projects\API\vendor\laravel\framework\src\Illuminate\Database\Connection.php: 664
  660:         // If an exception occurs when attempting to run a query, we'll format the error
  661:         // message to include the bindings with SQL, which will make this exception a
  662:         // lot more helpful to the developer instead of just the database's errors.
  663:         catch (Exception $e) {
  664:             throw new QueryException(
  665:                 $query, $this->prepareBindings($bindings), $e
  666:             );
  667:         }
  668:
  669:         return $result;

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint")
      C:\Projects\API\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php : 143

  2   PDOException::("SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint")
      C:\Projects\API\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php : 141

  Please use the argument -v to see more details.

[Request] Option to run a task once

It would be nice if one-off tasks could be be added as well.

Right now with the correct expression you can target it to run at a specific date/time but it would then run again the year after, unless the task has been removed.

config/totem.php is missing

The readme implies that there is a file called config/totem.php

This file is not installed as a package asset during the installation process.

Either the readme needs to reflect that the totem.php file needs to be copied manually or the

php artisan totem:assets
command should install the totem.php file (assuming there is not already a file)...

-FT

Disabled tasks get executed

We configured our cron tasks on our staging and production system using your awesome tool. After running some tests on the staging environment, we need to disable some tasks. Even after disabling some tasks they got executed and are shown using the command artisan schedule:list.

Is there a way to prevent them from executing without deleting them?

Thank you for your appreciated help.

Please rename the tables to totem_*

This package is fairly specific but it has table names that are highly likely to conflict with an existing application's tables.

"tasks" for example, we have a Task model in about 60% of our applications and having to change the table to application_tasks because a package has already used that table name is frustrating.

I am suggesting that we rename all tables to totem_*. We'll also need to drop and re-create the foreign key constraints as they'll still be named towards the old tables.

// Drop foreign key constraints
// ...

Schema::rename('tasks', 'totem_tasks');
Schema::rename('task_frequencies', 'totem_task_frequencies');
Schema::rename('task_results', 'totem_task_results');
Schema::rename('frequency_parameters', 'totem_frequency_parameters');

//Recreate foreign key constraints
// ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.