Skip to content

Instantly share code, notes, and snippets.

@lomotech
Created March 13, 2019 19:05
Show Gist options
  • Save lomotech/0433ef6c6b225bbeffb052b032065274 to your computer and use it in GitHub Desktop.
Save lomotech/0433ef6c6b225bbeffb052b032065274 to your computer and use it in GitHub Desktop.
repository problem
<?php
public static function getAll()
{
return Cache::remember('status:all', 60, function () {
return Status::all();
});
}
/**
* @param $category_id
* @return mixed
*/
public static function getByCategory($category_id = null)
{
$statuses = StatusRepository::getAll();
if ($category_id != null) {
$statuses->where('category_id', $category_id);
}
return $statuses;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment