halcyon

Experience

5,780

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 99 Lessons Completed
  • 2 Favorites

27th September, 2016

halcyon left a reply on Saving An Intervention Image Instance Into Amazon S3 • 1 year ago

thank you for the answer @Thatdoorsajar

i am using intervention/image 2.3.8 and your method is the one that works for me too

5th May, 2016

halcyon left a reply on Many To Many Filters Checkboxes • 2 years ago

oh well, managed to solve it myself =)

here is my solution, in case someone needs

$filters = $request->filters;

$query = \App\Restaurant::query();
$query->select(\DB::raw('id, name, address'));
$query->join('filter_restaurant', 'restaurants.id', '=', 'filter_restaurant.restaurant_id');
$query->where(function($query) use($filters)
{
    $query->whereIn('filter_id', $filters);
});
$query->groupBy('restaurants.id');
$query->havingRaw('count(*) = '.count($filters));

$restaurants = $query->get();
return $restaurants;

3rd May, 2016

halcyon started a new conversation Many To Many Filters Checkboxes • 2 years ago

Hi everyone, i got stuck doing this many to many filters.

TABLE : restaurants id name address

TABLE: filters id name

TABLE : filter_restaurant restaurant_id filter_id

On my HTML page, i have a list of filters[] checkboxes for users to select filters. For example, if user tick 2 checkboxes and submit, i do this in my controller to get the array $filters = $request->filters; let's say my $filters = [5, 7];

Current Situation - i wanted to filter restaurants that has both filters 5 and 7 but my current query is giving me restaurants that has either filter 5 or 7.

$query->select(\DB::raw('id, name, address'));
$query->whereHas('filters', function($query) use($filters)
{
    $query->whereIn('filter_id', $filters);
});```

really appreciate any help, thank you

26th April, 2016

halcyon left a reply on Socialite - Fail Gracefully? • 2 years ago

thank you for providing your solution 6 months ago. it helped me now :)

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.