/**
  * Check Unique Url
  *
  * @param Request $request
  * @return string Jquery Validation plugin only expect returns value string true or false
  */
 public function checkUniqueUrl(Request $request, $type, $id = null)
 {
     if ($request->ajax()) {
         $title = $request->input('title');
         switch ($type) {
             case 'house':
                 $resource = House::where('title', $title);
                 break;
             case 'project':
                 $resource = Project::where('title', $title);
                 break;
             case 'design':
                 $resource = Design::where('title', $title);
                 break;
         }
         if (!is_null($id)) {
             $resource = $resource->where('id', '<>', $id);
         }
         return 0 == $resource->count() ? 'true' : 'false';
     }
 }
示例#2
0
 private function _soldHouseList(Company $company)
 {
     return House::where('user_id', $company->user_id)->isOwner(OwnerTypeOptions::MOI_GIOI)->isSold(IsSoldOption::DA_BAN)->isApproved(1)->orderBy('id', 'desc');
 }