/**
  * Display a list of the conflicted classroom borrow record with input request
  *
  * @param int loan_id
  * @return Json
  */
 public function indexConflictClassroomBorrow($loan_id)
 {
     if (($loan = Loan::find($loan_id)) === null) {
         return response()->json(['status' => 2]);
     }
     $sample = ['p_id' => $loan->property_id, 'dates' => [$loan->date_began_at, $loan->date_ended_at], 'times' => [$loan->time_began_at, $loan->time_ended_at], 'LTK' => $loan->long_term_token];
     $conflict_list = Loan::getConflictList($sample)->join('users', 'users.id', '=', 'loans.user_id')->where('loans.id', '!=', $loan_id)->get(['loans.*', 'users.username', 'users.email', 'users.phone']);
     return response()->Json($conflict_list);
 }
 /**
  * Display a listing of the classroom borrow.
  *
  * @param string date
  * @return Json
  */
 public function indexDatedClassroomBorrow($date_began_at, $date_ended_at)
 {
     $sample = ['p_id' => null, 'dates' => [$date_began_at, $date_ended_at], 'times' => ['00:00:00', '23:59:59'], 'LTK' => 127];
     $classroom_borrow = Property::with(['status', 'loans' => function ($query) use($sample) {
         $query = Loan::getConflictList($sample, $query)->join('categories as type', 'type.id', '=', 'loans.type')->join('users', 'users.id', '=', 'user_id')->orderBy('loans.created_at', 'desc')->select('loans.*', 'users.username', 'users.phone', 'users.email');
         // signle day or not
         if ($dates[0] == $dates[1]) {
             $query->where('loans.user_id', '=', Auth::user()->id);
         } else {
             $query->where('loans.status', '=', Category::getCategoryId('loan.status', 'accepted'));
         }
     }])->where('category', '=', Category::getCategoryId('property', 'classroom'))->get();
     return response()->json($classroom_borrow);
 }