当前位置: 首页>>代码示例>>PHP>>正文


PHP dispatch函数代码示例

本文整理汇总了PHP中dispatch函数的典型用法代码示例。如果您正苦于以下问题:PHP dispatch函数的具体用法?PHP dispatch怎么用?PHP dispatch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dispatch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $s3 = \Storage::disk('s3');
     $filePath = '/jacobsgroupvegas/properties/' . env('APP_ENV') . '/' . $this->mls . '/' . $this->filename;
     $s3->put($filePath, file_get_contents('/tmp' . '/property-' . $this->mls . '-image-' . $this->filename), 'public');
     dispatch((new KillImageFromDisk($this->localDiskImage))->onQueue('killImage'));
 }
开发者ID:SapioBeasley,项目名称:jacobsgroupvegas.com,代码行数:12,代码来源:UploadImagesToS3.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /**
      * Create Roles by giving it an array
      */
     dispatch(new CreateRolesJob(['admin', 'manager', 'user']));
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:12,代码来源:RolesTableSeeder.php

示例3: handle

function handle($uri = '')
{
    try {
        if (($matched = dispatch($uri)) != null) {
            if (!before()) {
                $handler = $matched['handler'];
                if (!empty($matched['options']['router'])) {
                    $handler = call_user_func($handler, $matched);
                }
                if (!empty($matched['options']['create'])) {
                    $controllerClass = $handler[0];
                    $handler[0] = new $controllerClass();
                }
                if (isset($matched['params'])) {
                    call_user_func_array($handler, $matched['params']);
                } else {
                    call_user_func_array($handler, $matched['segments']);
                }
                after();
            }
        } else {
            notFound();
        }
        finish();
    } catch (Exception $e) {
        error_log($e->getMessage());
        error_log($e->getTraceAsString());
    }
    exit;
}
开发者ID:rivetweb,项目名称:old-php-seomonitor,代码行数:30,代码来源:flacon.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /**
      * Login Api
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.user.login', 'description' => 'Log the user in the system and returns a unique token', 'parameters' => json_encode(['credential' => 'Required - Username or Email', 'password' => 'Required - User Password']), 'response' => json_encode(["username" => "test", "email" => "test@email.com", "gender" => 'male', "country_id" => "30", "age_id" => 1, "api_token" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "newsletter" => "0"]), 'response_error' => json_encode(['error' => 'invalid_username_or_password', "credential" => ["The credential field is required."], "password" => ["The password field is required."]])]));
     /**
      * Register Api
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.user.register', 'description' => 'Register a new User into the database', 'parameters' => json_encode(['username' => 'Required - Unique Username', 'email' => 'Required - User Email', 'password' => 'Required - User Password', 'password_confirmation' => 'Required - Password Confirmation', 'terms' => 'Required - Accept the terms and conditions of usage', 'gender' => 'User Gender Male or Female', 'country_id' => 'Country id as on Country Api', 'newsletter' => 'Accept to Receive newsletter', 'age_id' => 'Age ID']), 'response' => json_encode(["username" => "test", "email" => "test@email.com", "gender" => null, "country_id" => "30", "age_id" => 2, "api_token" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "newsletter" => "0"]), 'response_error' => json_encode(["error" => ["username" => ["The username field is required."], "email" => ["The email field is required. | The email has already been taken."], "password" => ["The password field is required."], "terms" => ["The terms field is required."]]])]));
     /**
      * Products Api
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.product.index', 'description' => 'Return list with all available products', 'parameters' => json_encode(['api_token' => 'Required - User Token']), 'response' => json_encode([["id" => 1, "code" => "MF001", "name" => "Batman Stand Version I"], ["id" => 2, "code" => "MF002", "name" => "Superman Stand Version I"], ["id" => 3, "code" => "MF003", "name" => "Worderwoman Stand Version I"]]), 'response_error' => json_encode([["error" => "token_not_provided"], ["error" => "invalid_token"]])]));
     /**
      * Single Product Show
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.product.show', 'description' => 'Return information about an specific product', 'parameters' => json_encode(['api_token' => 'Required - User Token', 'product_id' => 'Required - Product Code or ID', 'encode_image' => 'Optional - Determine whether retrieve image as a link or as Base64']), 'response' => json_encode(["id" => 1, "name" => "Batman Stand Version I", "code" => "MF001", "image" => ["image/products/MF001.png", ['mime' => "image/png", 'dirname' => "image/products", 'basename' => "MF001.png", 'extension' => "png", 'filename' => "MF001", 'encoder' => 'data:image/png;base64,iVBORw0KGgoAAAANSUh....']]]), 'response_error' => json_encode([["error" => "invalid_code"], ["error" => "token_not_provided"], ["error" => "invalid_token"]])]));
     /**
      * Product Register
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.product.register', 'description' => 'Return information about an specific product', 'parameters' => json_encode(['api_token' => 'Required - User Token', 'code' => 'Required - Product Code']), 'response' => json_encode(["status" => 'okay']), 'response_error' => json_encode([["error" => "invalid_code"], ["error" => "token_not_provided"], ["error" => "invalid_token"], ["error" => " code_has_been_taken"]])]));
     /**
      * Forms Api
      */
     /**
      * Countries
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.form.countries', 'description' => 'Return a list with all countries', 'parameters' => null, 'response' => json_encode(["id" => 50, "code" => "CN", "name" => "China (中国)"]), 'response_error' => null]));
     /**
      * Ages
      */
     dispatch(new CreateAPIHelpJob(['route' => 'api.form.ages', 'description' => 'Return a list with all ages', 'parameters' => null, 'response' => json_encode(["id" => 1, "from" => 10, "to" => 20]), 'response_error' => null]));
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:39,代码来源:HelperTableSeeder.php

示例5: removePermission

 public function removePermission($permission)
 {
     if ($permission = $this->collectPermissions($permission)) {
         $this->permissions()->detach($permission);
         dispatch(new EvictCachedRolePermissions($this));
     }
 }
开发者ID:znck,项目名称:trust,代码行数:7,代码来源:Role.php

示例6: addUniqueJob

 /**
  * Adds a Job to the queue only if one does not
  * already exist.
  *
  * @param $job
  * @param $args
  *
  * @return mixed
  */
 public function addUniqueJob($job, JobPayloadContainer $args)
 {
     // Refuse to pop a job onto the queue if the admin
     // has not yet configured an administrative contact.
     // See: https://github.com/eveseat/seat/issues/77 (Request by CCP)
     if ($this->hasDefaultAdminContact()) {
         logger()->error('Default admin contact still set. Not queuing job for: ' . $args->api);
         return 'Failed to queue due to default config';
     }
     // Look for an existing job
     $job_id = JobTracking::where('owner_id', $args->owner_id)->where('api', $args->api)->whereIn('status', ['Queued', 'Working'])->value('job_id');
     // Just return if the job already exists
     if ($job_id) {
         logger()->warning('A job for Api ' . $args->api . ' and owner ' . $args->owner_id . ' already exists.');
         return $job_id;
     }
     // Add a new job onto the queue...
     $new_job = (new $job($args))->onQueue($args->queue);
     $job_id = dispatch($new_job);
     // Check that the id we got back is a random
     // string and not 0. In fact, normal job_ids
     // are like a 32char string, so just check that
     // its more than 2. If its not, we can assume
     // the job itself was not sucesfully added.
     // If it actually is queued, it will get discarded
     // when trackOrDismiss() is called.
     if (strlen($job_id) < 2) {
         return;
     }
     // ...and add tracking information
     JobTracking::create(['job_id' => $job_id, 'owner_id' => $args->owner_id, 'api' => $args->api, 'scope' => $args->scope, 'status' => 'Queued']);
     return $job_id;
 }
开发者ID:eveseat,项目名称:eveapi,代码行数:42,代码来源:JobManager.php

示例7: actionBulk

 public function actionBulk(Request $request)
 {
     $input = $request->all();
     $ids = (isset($input['table_records']) and is_array($input['table_records'])) ? $input['table_records'] : [$input['table_records']];
     // dd($ids);
     $message = '';
     $error = 0;
     if (empty($ids)) {
         return redirect()->back();
     }
     switch ($input['submit']) {
         case 'delete':
             foreach ($ids as $id) {
                 ClassroomInterval::where('id', $id)->has('sessions', '=', 0)->delete();
             }
             $message = 'تم الحذف بنجاح';
             break;
         case 'generate':
             foreach (ClassroomInterval::whereIn('id', $ids)->waiting()->get() as $interval) {
                 $interval->state = 'generating';
                 $interval->save();
                 dispatch(new CreateVirtualClassroomsJobs($interval));
                 return redirect()->route('classrooms.intervals.index');
             }
             break;
         default:
             # code...
             break;
     }
     return redirect()->back()->with($error ? 'error' : 'success', $message);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:31,代码来源:IntervalsController.php

示例8: swapForFree

 /**
  * Swap subscription.
  *
  * @return Response
  */
 public function swapForFree(Subscription $subscription)
 {
     if ($subscription->price != 0) {
         return false;
     }
     dispatch(new swapSubscription($subscription, $this->user));
     return true;
 }
开发者ID:zedx,项目名称:core,代码行数:13,代码来源:SubscriptionService.php

示例9: smarty_function_dispatch

function smarty_function_dispatch($params, $template)
{
    //$saved_REQUEST = $_REQUEST;
    //$_REQUEST = $params;
    $str = dispatch($params['c'], $params['a']);
    //$_REQUEST = $saved_REQUEST;
    return $str;
}
开发者ID:srdc2014,项目名称:vhms,代码行数:8,代码来源:function.dispatch.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     \Redis::subscribe('demeterMiddle', function ($message) {
         $m = json_decode($message);
         echo var_dump($m);
         dispatch(new \App\Jobs\handleVmRequest($m));
     });
 }
开发者ID:DCUnit711,项目名称:Demeter,代码行数:13,代码来源:redisListener.php

示例11: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $properties = \App\Property::all();
     foreach ($properties as $property) {
         $property->delete();
     }
     dispatch((new RemoveUnrelatedImages())->onQueue('killImage'));
 }
开发者ID:SapioBeasley,项目名称:jacobsgroupvegas.com,代码行数:13,代码来源:KillAllProperties.php

示例12: execCommand

 protected function execCommand()
 {
     $transaction = $this->order->transaction;
     $command = $transaction->command;
     if ($command) {
         dispatch(new $command($this->order));
     }
 }
开发者ID:zedx,项目名称:core,代码行数:8,代码来源:PaymentService.php

示例13: handle

 /**
  * Handle the event.
  *
  * @param  Purchase  $event
  * @return void
  */
 public function handle(Purchase $event)
 {
     $customer = $event->customer;
     $order = $event->order;
     if (is_null(Order::where('customer_id', $customer->id)->where('order_status_id', '>=', 2)->where('id', '!=', $order->id)->first())) {
         dispatch(new FirstOrderFeedback($customer));
     }
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:14,代码来源:GiveFirstPurchaseBeanOrNot.php

示例14: handle

 /**
  * Handle the event.
  *
  * @param  Purchase  $event
  * @return void
  */
 public function handle(Purchase $event)
 {
     $customer = $event->customer;
     $upper = $customer->getReferrer();
     $order = $event->order;
     if ($upper && in_array($upper->doctorType(), ['A', 'B'])) {
         dispatch(new CashConsumeFeedback($upper, $order->cash_payment));
     }
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:15,代码来源:GiveYourUpperPurchaseFeedbackOrNot.php

示例15: addScheduleAction

 /**
  * Creates a new scheduled maintenance "incident".
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function addScheduleAction()
 {
     try {
         $incident = dispatch(new ReportMaintenanceCommand(Binput::get('name'), Binput::get('message'), Binput::get('notify'), Binput::get('scheduled_at')));
     } catch (ValidationException $e) {
         return Redirect::route('dashboard.schedule.add')->withInput(Binput::all())->withSuccess(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.schedule.add.failure')))->withErrors($e->getMessageBag());
     }
     return Redirect::route('dashboard.schedule.index')->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.add.success')));
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:14,代码来源:ScheduleController.php


注:本文中的dispatch函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。