summaryrefslogtreecommitdiff
path: root/app/Http/Controllers/IndexController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http/Controllers/IndexController.php')
-rw-r--r--app/Http/Controllers/IndexController.php41
1 files changed, 39 insertions, 2 deletions
diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php
index d9e792a..c595b4e 100644
--- a/app/Http/Controllers/IndexController.php
+++ b/app/Http/Controllers/IndexController.php
@@ -11,6 +11,9 @@ use App\AnimeStats;
use App\MALUser;
use App\Libraries\Helper;
+use App\Jobs\AddNewCalUser;
+use Imtigger\LaravelJobStatus\JobStatus;
+
class IndexController extends Controller {
/**
* Shows the index page.
@@ -81,10 +84,12 @@ class IndexController extends Controller {
echo "OK";
}
- public function createUser( $username ) {
+ public function _createUser( $username ) {
$helper = new Helper();
$helper->createUser( $username );
- $helper->setIsWatching( $username );
+ if ( false === $helper->setIsWatching( $username ) ) {
+ echo "not ok"; return;
+ }
$helper->setCalendar( $username );
echo "OK. https://animes.iamfabulous.de/ical/" . $username;
return;
@@ -103,4 +108,36 @@ class IndexController extends Controller {
echo $user->get();
}
+
+ public function createUser( $username ) {
+
+ $job = new AddNewCalUser( $username );
+ #$job = AddNewCalUser::create();
+ $id = $job::dispatch( $username );
+
+ echo "<pre>";
+ #var_dump($job->id);
+ var_dump($job);
+ var_dump($id);
+ #$jobStatusId = $job->getJobStatusId();
+ #echo "https://anistats.com/status/" . $jobStatusId;
+ }
+
+ public function showJobStatus( $jobStatusId ) {
+ $jobStatus = JobStatus::find($jobStatusId);
+
+ echo "<pre>";
+ /*
+ while ( "queued" == $jobStatus->status || "executing" == $jobStatus->status ) {
+ echo $jobStatus->status;
+ echo "";
+ $jobStatus = JobStatus::find($jobStatusId);
+ sleep(1);
+ }
+ */
+
+ var_dump($jobStatus);
+ var_dump($jobStatus->output);
+
+ }
}