M
M
maiskiykot2021-11-26 21:54:20
Laravel
maiskiykot, 2021-11-26 21:54:20

How to get related values ​​in model?

Greetings. As usual, a puzzle that seems to be simple, but at the same time tricky . I
use a simple haspermission check based on a comparison of permissions in the route and user permissions. To do this, I created middlware, which in turn refers to the User class:

public function hasPermission($check)
    {
        return in_array($check, array_pluck($this->permissions, 'slug'));
    }

What is the problem? The $this array contains all the correct data, incl. associated permissions data. However, the above function returns null. Those. namely the empty array $this->permissions. Hence the question: what to change to reach this array? So far, I can't figure it out myself. Thanks to all!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
maiskiykot, 2021-11-26
@maiskiykot

I understand that it looks crazy, but so far I have decided this:
$this->permissions()->get()->values()
So far I have not been able to get through in a different way.

R
Roman, 2015-04-14
@paradoxo

Try using after with background and transform property: skew
and set parent to overflow

A
Alexander Talalaev, 2015-04-14
@neuotq

1. Apply a normal long shadow, only on the element hidden under this picture, I think you can pick up
2. Make a lot of shadows to take into account the angles, but here you need to work mattlambert.ca/blog/create-a-flat-long-shadow-icon. .. + make a font from the icon. maybe perverted, but ... otherwise only photoshop and other methods.
3. Here's what else you can try, I initially thought that svg was missing, but suddenly design.tutsplus.com/tutorials/quick-tip-techniques... , the attempt is not torture, it might work out.

H
Hazrat Hajikerimov, 2015-04-14
@hazratgs

sandbox.juan-i.com/longshadows

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question