public function chkUserLike(Request $request) { $like = IwomenPostLike::where('postId', $request->postId)->where('userId', $request->userId)->first(); if ($like) { return response()->json(true); } return response()->json(false); }
public function search($input) { $query = IwomenPostLike::query(); $columns = Schema::getColumnListing('iwomenPostLikes'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }