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

Allow null Reacterable in Reactant facade #94

Closed
antonkomarev opened this issue Jul 30, 2019 · 0 comments · Fixed by #99
Closed

Allow null Reacterable in Reactant facade #94

antonkomarev opened this issue Jul 30, 2019 · 0 comments · Fixed by #99
Milestone

Comments

@antonkomarev
Copy link
Member

antonkomarev commented Jul 30, 2019

Motivation

Because auth()->user() can return null we can't call isReactedBy method without checking for the first argument is not null.

@if (auth()->check() && $post->viaLoveReactant()->isReactedBy(auth()->user(), 'Like'))

We can check for the null value inside of the facade method.

@if ($post->viaLoveReactant()->isReactedBy(auth()->user(), 'Like'))

Current Implementation

$reactantFacade->isReactedBy(
  Reacterable $reacterable,
  ?string $reactionTypeName = null
);

$reactantFacade->isNotReactedBy(
  Reacterable $reacterable,
  ?string $reactionTypeName = null
);

New Implementation

$reactantFacade->isReactedBy(
  ?Reacterable $reacterable = null,
  ?string $reactionTypeName = null
);

$reactantFacade->isNotReactedBy(
  ?Reacterable $reacterable = null,
  ?string $reactionTypeName = null
);
@antonkomarev antonkomarev added this to the v8.0.0 milestone Jul 30, 2019
@antonkomarev antonkomarev changed the title Make Reactant facade less restrictive Allow null Reacterable in Reactant facade Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant