/** * Execute the console command. * * @param \Seat\Eveapi\Helpers\JobPayloadContainer $job * * @return mixed */ public function handle(JobPayloadContainer $job) { // Query the API Keys from the database // and queue jobs for them 10 at a time. $key = ApiKey::findOrFail($this->argument('key_id')); $job->scope = 'Key'; $job->api = 'Scheduler'; $job->owner_id = $key->key_id; $job->eve_api_key = $key; $job_id = $this->addUniqueJob(CheckAndQueueKey::class, $job); $this->info('Job ' . $job_id . ' dispatched!'); // Analytics dispatch((new Analytics((new AnalyticsContainer())->set('type', 'event')->set('ec', 'queues')->set('ea', 'queue_key')->set('el', 'console')))->onQueue('medium')); }
/** * @param \Seat\Web\Http\Validation\WorkerConstraint $request * * @return \Illuminate\Http\RedirectResponse */ public function postUpdateWorkerConstraint(WorkerConstraint $request) { $key = ApiKeyModel::findOrFail($request->input('key_id')); // Build a new constraints array from the input data $constraints = ['character' => $request->input('character'), 'corporation' => $request->input('corporation')]; $key->api_call_constraints = $constraints; $key->save(); // Redirect back with new values. return redirect()->back()->with('success', 'Constraints Updated'); }
/** * @param \Illuminate\Http\Request $request * @param $key_id * * @return \Illuminate\Http\RedirectResponse */ public function transfer(Request $request, $key_id) { $key = ApiKeyModel::findOrFail($key_id); $user = User::findOrFail($request->user_id); $key->user_id = $user->id; $key->save(); return redirect()->back()->with('success', 'Key successfully transferred to ' . $user->name); }
/** * Transfer an EVE API Key to a User * * @param $key_id * @param $user_id * * @return \Illuminate\Http\JsonResponse */ public function transfer($key_id, $user_id) { $key = ApiKey::findOrFail($key_id); User::findOrFail($user_id); $key->user_id = $user_id; $key->save(); return response()->json(['ok']); }