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


PHP Task::delete方法代码示例

本文整理汇总了PHP中app\Task::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::delete方法的具体用法?PHP Task::delete怎么用?PHP Task::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Task的用法示例。


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

示例1: finishTask

 /**
  * @param Task $task
  */
 public static function finishTask(Task $task)
 {
     switch ($task->type) {
         case 1:
             // create worker
             $task->building->city->human_resources->workers += 1;
             $task->building->city->human_resources->save();
             $task->delete();
             break;
         case 2:
             // create settler
             $task->building->city->human_resources->settlers += 1;
             $task->building->city->human_resources->save();
             $task->delete();
             break;
         case 3:
             // create a general
             if ($task->building->city->hex->army_id == 0) {
                 $army = Army::create(['user_id' => $task->building->city->owner, 'current_hex_id' => $task->building->city->hex->id]);
                 $task->building->city->hex->army_id = $army->id;
                 $task->building->city->hex->save();
             }
             if ($task->building->city->hex->army->general) {
                 break;
             }
             $task->building->city->hex->army->update(['general' => true]);
             $task->delete();
             break;
         case 11:
             // create unit
         // create unit
         case 12:
         case 13:
         case 14:
         case 15:
         case 16:
         case 17:
             if ($task->building->city->hex->army_id == 0) {
                 $army = Army::create(['user_id' => $task->building->city->owner, 'current_hex_id' => $task->building->city->hex->id]);
                 $task->building->city->hex->army_id = $army->id;
                 $task->building->city->hex->save();
             }
             $unit_type = 'unit' . ($task->type - 10);
             $task->building->city->hex->army->{$unit_type} += 1;
             $task->building->city->hex->army->save();
             $task->delete();
             break;
         case 20:
             // move army
             ArmyController::pathProgress($task);
             break;
     }
 }
开发者ID:nadapapa,项目名称:PHP-RTS-game,代码行数:56,代码来源:TaskController.php

示例2: destroy

 /**
  * Destroy the given task.
  *
  * @param  Request  $request
  * @param  Task  $task
  * @return Response
  */
 public function destroy(Request $request, Task $task)
 {
     if (\Auth::id() == $task->user_id) {
         $task->delete();
     }
     return redirect('/tasks');
 }
开发者ID:anhtt93,项目名称:BookStore,代码行数:14,代码来源:TaskController.php

示例3: pathProgress

 /**
  * checks each step of the path if it was completed (based on its timestamp).
  * also calls the findCrossingPath method to (surprise!) find the paths crossing the current path
  *
  * @param Task $task
  */
 public static function pathProgress(Task $task)
 {
     if ($task->path->isEmpty()) {
         $task->army->update(['task_id' => 0, 'path_id' => 0]);
         $task->delete();
         return;
     }
     $path = $task->path;
     self::processFoodConsumption($path);
     $finished = null;
     $path->filter(function ($item) use(&$finished) {
         if ($item->finished_at <= Carbon::now()) {
             // if the step is finished
             self::findCrossingPath($item);
             $finished = $item;
             $item->delete();
         }
     });
     // now $finished is the last element of the path.
     // $finished has the hex where the army is
     if ($finished != null) {
         $army = $task->army;
         $army->currentHex->update(['army_id' => 0]);
         $army->update(['current_hex_id' => $finished->hex_id]);
         $finished->hex->update(['army_id' => $army->id]);
     }
     if ($path->isEmpty()) {
         $task->army->update(['task_id' => 0, 'path_id' => 0]);
         $task->delete();
     }
 }
开发者ID:nadapapa,项目名称:PHP-RTS-game,代码行数:37,代码来源:ArmyController.php

示例4: getDelete

 public function getDelete(Task $task)
 {
     if ($task->user_id == Auth::user()->id) {
         //delete task als de juiste user is ingelogd
         $task->delete();
     }
     return Redirect::route('home');
 }
开发者ID:gurbuzhasan,项目名称:web-backend-oplossingen,代码行数:8,代码来源:PagesController.php

示例5: delete

 public function delete(Task $task)
 {
     $task->delete();
     return redirect('/');
     //print_r($task);
 }
开发者ID:Anton-Patokin,项目名称:web-backend-oplossingen,代码行数:6,代码来源:TodoController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Task $task, TaskRequest $request)
 {
     Log::info("[App\\TaskController]: Delete a Task");
     $task->delete();
     return response()->json(array('success' => true));
 }
开发者ID:kmassada,项目名称:laravel-angular,代码行数:12,代码来源:TaskController.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Project $project, Task $task)
 {
     $task->delete();
     return Redirect::route('projects.tasks.index', array($project->id, $task->id))->with('message', 'Tarefa deletada!');
 }
开发者ID:nailton,项目名称:l5todo,代码行数:11,代码来源:TasksController.php

示例8: destroy

 /**
  * Destroy the given task.
  *
  * @param  Request $request
  * @param  Task $task
  * @return Response
  */
 public function destroy(Request $request, Task $task)
 {
     $task->delete();
     return redirect('/tasks');
 }
开发者ID:d10cn2btt,项目名称:studyBtt,代码行数:12,代码来源:TaskController.php

示例9: destroy

 public function destroy(Task $task)
 {
     $task->delete();
     return response()->json(['message' => 'Tarea borrada exitosamente.']);
 }
开发者ID:wyrover,项目名称:todo-api-server,代码行数:5,代码来源:TasksController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Project $project, Task $task)
 {
     $task->delete();
     return Redirect::route('projects.open', $project->slug)->with('message', 'Task deleted.');
 }
开发者ID:jonodonovan,项目名称:jodonovan-com,代码行数:11,代码来源:TasksController.php

示例11: destroy

 /**
  * Remove the specified resource from storage
  * @param Project $project
  * @param Task $task
  */
 public function destroy(Project $project, Task $task, Request $request)
 {
     $this->validate($request, $this->rules);
     $task->delete();
     return Redirect::route('projects.show', $project->slug)->with('message', 'Task Deleted');
 }
开发者ID:arikWaisman,项目名称:Laravel-5-todo,代码行数:11,代码来源:TasksController.php

示例12: destroy

 public function destroy(Category $category, Task $task)
 {
     $task->delete();
     return Redirect::route('categories.show', $category->slug)->with('message', 'Task deleted.');
 }
开发者ID:leloulight,项目名称:csci71-FinalProject,代码行数:5,代码来源:TasksController.php

示例13: destroy

 public function destroy(Request $request, Task $task)
 {
     //$this->authorize('destroy', $task);
     $task->delete();
     return redirect('/tasks');
 }
开发者ID:Anton-Patokin,项目名称:web-backend-oplossingen,代码行数:6,代码来源:TaskController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  \App\Project $project
  * @param  \App\Task    $task
  * @return Response
  */
 public function destroy(Project $project, Task $task)
 {
     //
     $task->delete();
     return Redirect::route('projects.show', $project->slug)->with('message', 'Success: Your Task deleted.');
 }
开发者ID:ikram2001,项目名称:laravel-5.1-basic-app,代码行数:13,代码来源:TasksController.php

示例15: delete

 /**
  * Delete the given Driver.
  *
  * @param  Task $task
  */
 public function delete(Task $task)
 {
     $task->delete();
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:9,代码来源:TaskController.php


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