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


PHP Task::all方法代码示例

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


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

示例1: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $tasks = \App\Models\Task::all();
     foreach ($tasks as $task) {
         $startTime = strtotime($task->start_time);
         if (!$task->time_log || !count(json_decode($task->time_log))) {
             $task->time_log = json_encode([[$startTime, $startTime + $task->duration]]);
             $task->save();
         } elseif ($task->getDuration() != intval($task->duration)) {
             $task->time_log = json_encode([[$startTime, $startTime + $task->duration]]);
             $task->save();
         }
     }
     Schema::table('tasks', function ($table) {
         $table->dropColumn('start_time');
         $table->dropColumn('duration');
         $table->dropColumn('break_duration');
         $table->dropColumn('resume_time');
     });
     Schema::table('users', function ($table) {
         $table->boolean('dark_mode')->default(false)->nullable();
     });
     Schema::table('users', function ($table) {
         $table->dropColumn('theme_id');
     });
 }
开发者ID:magicians,项目名称:invoiceninja,代码行数:31,代码来源:2015_07_08_114333_simplify_tasks.php

示例2: function

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('home.index');
});
// collection.fetch()
Route::get('tasks', function () {
    $fetchTasks = Task::all();
    return $fetchTasks;
});
// model.fetch()
Route::get('tasks/{id}', function ($id) {
    $tasks = Task::find($id);
    if ($tasks) {
        return json_encode($tasks);
    } else {
        abort(404);
    }
});
// model.save() - if id exist
Route::put('tasks/{id}', function ($id) {
    $input = Input::all();
    $task = Task::find($id);
开发者ID:rmvavilov,项目名称:laravel,代码行数:31,代码来源:routes.php

示例3: index

 /**
  * @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function index()
 {
     $tasks = Task::all();
     $response = ['code' => 200, 'message' => 'OK', 'data' => $tasks];
     return response()->json($response, $response['code']);
 }
开发者ID:richriscunha,项目名称:vuedue,代码行数:9,代码来源:TaskController.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $data['colors'] = array('red', 'yellow', 'aqua', 'blue', 'light-blue', 'green', 'navy', 'teal', 'olive', 'lime', 'orange', 'fuchsia', 'purple', 'maroon', 'black', 'red-active', 'yellow-active', 'aqua-active', 'blue-active', 'light-blue-active', 'green-active', 'navy-active', 'teal-active', 'olive-active', 'lime-active', 'orange-active', 'fuchsia-active', 'purple-active', 'maroon-active', 'black-active');
     $data['card'] = $card = Card::get_card_result($id);
     if ($card) {
         $data['project'] = Project::find($card->project_id);
         $data['goals'] = Project::get_goals($card->project_id);
         $data['campgoals'] = Card::get_campgoals($id);
         $data['plannedcampgoals'] = Card::get_panned_campgoals($id);
         $data['partner'] = Card::get_partner($id, $card->sector_id);
         $data['partners'] = Card::get_partners($id, $card->sector_id);
         $data['camps'] = Camp::where('card_id', $id)->get()->toArray();
         $data['selectedpartner'] = PartnerCards::where('card_id', $id)->first();
         $data['cardtimelines'] = Timeline::getFinalCardTimeline($id, 2);
         $data['campcreatebtn'] = Permission::hasPermission('camps.create');
         $data['campeditbtn'] = Permission::hasPermission('camps.edit');
         $data['campdeletebtn'] = Permission::hasPermission('camps.delete');
         $data['campimportbtn'] = Permission::hasPermission('camps.import');
         $data['taskimportbtn'] = Permission::hasPermission('tasks.import');
         $data['taskeditbtn'] = Permission::hasPermission('tasks.edit');
         $data['taskcreatebtn'] = Permission::hasPermission('tasks.create');
         $data['taskdeletebtn'] = Permission::hasPermission('tasks.delete');
         $data['tasklistbtn'] = Permission::hasPermission('tasks.index');
         $data['campviewbtn'] = Permission::hasPermission('camps.show');
         $data['tasks'] = Task::all();
         return view('cards.view', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:37,代码来源:CardController.php

示例5: index

 public function index()
 {
     $tasks = Task::all();
     return response()->json(['status' => 'success', 'data' => $tasks]);
 }
开发者ID:devchd,项目名称:todo,代码行数:5,代码来源:TasksController.php


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