Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw10 - Применить кэширование #551

Open
wants to merge 11 commits into
base: NGalkin/hw9
Choose a base branch
from

Conversation

OzyAst
Copy link

@OzyAst OzyAst commented Aug 12, 2020

No description provided.

* Списк всех процедур для салона
* @return Collection|null
*/
public function getMyRecord(): ?Collection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше использовать getUserRecords(User $user): Collection

А Юзера брать в контроллере, потому что если вызовите команду например в консольной комманде - то получите ошибку пользователя не будет

* @param int $id
* @return Collection|null
*/
public function get(int $id): ?Business
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы предложил назвать метод
findCachedBusiness()


return Cache::remember($key, $ttl, function () use ($id) {
$business = $this->repository->find($id);
$business->procedures;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно делать
$business->load(['procedures', ...])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants