コード例 #1
0
ファイル: OvertimeController.php プロジェクト: mahemrai/otman
 /**
  * @param  int $id
  * @return array
  */
 public function get($userId = null, $overtimeId = null)
 {
     if (is_null($overtimeId)) {
         $overtimes = Overtime::where('user_id', $userId)->orderBy('created_at', 'desc')->take(5)->get();
         return array('code' => 1, 'status' => 'ok', 'overtimes' => $overtimes);
     } else {
         $overtime = Overtime::find($overtimeId);
         return array('code' => 1, 'status' => 'ok', 'overtime' => $overtime);
     }
 }