Comments (17)
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.
@JosephSilber Yep, forgot to said it... it's 5.1
from bouncer.
I just published v0.1.4 with that fix.
from bouncer.
Whoops. I missed the array
type hint.
Here goes v0.1.5.
Can you please test it in your project?
from bouncer.
:'( 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.
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.
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.
\Silber\Bouncer\Clipboard::compileModelAbilityIdentifiers:169
is trying to create UserPresenter
model, not the User
model. That's the problem.
from bouncer.
In parseGateArguments
method User model transforms to UserPresenter model:
return [
head($arguments) ?: null,
null
];
from bouncer.
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.
from bouncer.
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.
from bouncer.
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.
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.
from bouncer.
No more errors, confirmed!
Could releases be deleted? Don't ever tried to do so.
from bouncer.
Related Issues (20)
- setup with filament not working HOT 1
- No migrations when upgrading from 1.0.0-rc.3 HOT 1
- Question: How can I get certain model Instance's users with ability 'update' ? HOT 1
- Can helper returning true after removing role from the user HOT 2
- error foreign keys with Planetscale HOT 3
- How To Add / Remove Roles Temporarily (for current request only) ? HOT 5
- [HELP] Extend Ability HOT 1
- Migration issues using Multitenancy System HOT 8
- Get all users with all their roles HOT 2
- scope is not reset between tests HOT 5
- Fine grade check delete ability
- Adjust connection for can() gate
- How to get owns and check is owned HOT 1
- Is it possible to keep all abilities hardcoded instead of abilities table HOT 1
- Permission on belongToMany relation of entity HOT 4
- enforceMorphMap support
- Documentation is extremely time consuming and confusing
- UUID guide please
- Add Granted By
- Is there any way to refresh() cache for all tenants
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bouncer.