Giter Site home page Giter Site logo

Comments (17)

JosephSilber avatar JosephSilber commented on August 16, 2024

Seems like you're still on 5.1, yes?

Yeah. They only changed it for 5.2 :(

I'll have a fix soon.

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

@JosephSilber Yep, forgot to said it... it's 5.1

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

I just published v0.1.4 with that fix.

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

Whoops. I missed the array type hint.

Here goes v0.1.5.

Can you please test it in your project?

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

:'( Nope

Missing argument 1 for App\Presenter\Presenter::__construct(), called in /home/ell/Development/sitterland/vendor/silber/bouncer/src/Clipboard.php on line 169.

My user model is wrapper in presenter, but I dont think this will change things.

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

This does not seem to be related to this issue. Does it work in 0.1.2?

To help debug this, can you show me the code for your User model?

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

Yes it's working in 0.1.2.

All the code is in the traits, but I've rechecked all of them, none overwriting __construct method.

class User extends Model implements AuthenticatableContract,
    AuthorizableContract,
    CanResetPasswordContract,
    HasMediaConversions,
    Reviewable
{
    use Authenticatable,
        Authorizable,
        CanResetPassword,
        PresentableTrait,
        ReviewableTrait,
        HasRolesAndAbilities,
        Messagable,
        LastSeenTrait,
        OnlineTrait,
        HasMediaTrait,
        EmailableTrait,
        AddressableTrait,
        ApplicantTrait,
        SoftDeletes,
        BannableTrait;

    public $presenter = UserPresenter::class;
    protected $table = 'user';
}

I've omitted only relations and fillable fields.

And presentable trait is pretty simple:

<?php

namespace Cog\Presenter\Traits;

use Cog\Presenter\Exceptions\PresenterException;

trait PresentableTrait
{

    /**
     * View presenter instance
     *
     * @var mixed
     */
    protected $presenterInstance;

    /**
     * Prepare a new or cached presenter instance
     *
     * @return mixed
     * @throws PresenterException
     */
    public function present()
    {
        if (!$this->presenter or !class_exists($this->presenter)) {
            throw new PresenterException('Please set the $presenter property to your presenter path.');
        }

        if (!$this->presenterInstance) {
            $this->presenterInstance = new $this->presenter($this);
        }

        return $this->presenterInstance;
    }
}

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

\Silber\Bouncer\Clipboard::compileModelAbilityIdentifiers:169 is trying to create UserPresenter model, not the User model. That's the problem.

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

In parseGateArguments method User model transforms to UserPresenter model:

return [
    head($arguments) ?: null,
    null
];

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

Why is it trying to create a user presenter model? And why would that be any different in 0.1.2?

It tries to create a new instance of whatever was passed in. Is the $user you're passing in an Eloquent model, or an instance of the presenter.

If it's a model, it should always work. If it's a presenter, it shouldn't be working on 0.1.2 either.

On Feb 21, 2016, at 1:08 AM, Pe Ell [email protected] wrote:

\Silber\Bouncer\Clipboard::compileModelAbilityIdentifiers:169 is trying to create UserPresenter model, not the User model. That's the problem.


Reply to this email directly or view it on GitHub.

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

And here you can see dd($arguments):

User {#731 ▼
  +presenter: "App\Presenters\UserPresenter"
  #table: "user"
  #fillable: array:3 [▶]
  #hidden: array:2 [▶]
  #connection: null
  #primaryKey: "id"
  #perPage: 15
  +incrementing: true
  +timestamps: true
  #attributes: array:10 [▶]
  #original: array:10 [▶]
  #relations: array:1 [▶]
  #visible: []
  #appends: []
  #guarded: array:1 [▶]
  #dates: []
  #dateFormat: null
  #casts: []
  #touches: []
  #observables: []
  #with: []
  #morphClass: null
  +exists: true
  +wasRecentlyCreated: false
  #presenterInstance: null
  +mediaConversions: []
  #forceDeleting: false
}

I don't know how, but I closed issue :\

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

It was a stupid missclick :}

return $arguments;

Yes, as you said - it solved an issue. Should I make PR for it, or you will do it yourself?

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

If you send a PR now I'll merge it.

return [$arguments, null];

I'm on my phone.

On Feb 21, 2016, at 1:27 AM, Pe Ell [email protected] wrote:

It was a stupid missclick :}

return $arguments;
Yes, as you said - it solved an issue. Should I make PR for it, or you will do it yourself?


Reply to this email directly or view it on GitHub.

from bouncer.

JosephSilber avatar JosephSilber commented on August 16, 2024

from bouncer.

antonkomarev avatar antonkomarev commented on August 16, 2024

No more errors, confirmed!

Could releases be deleted? Don't ever tried to do so.

from bouncer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.