Comments (48)
I imagine it'll be updated to every major laravel version
from laravel-boilerplate.
Yeah it will be updated providing there will be an upgrade guide which I'm sure there will. I'm going to refresh and start from scratch with every major release.
Anthony Rappa
On May 16, 2015, at 13:38, Freddy Heppell [email protected] wrote:
I imagine it'll be updated to every major laravel version
—
Reply to this email directly or view it on GitHub.
from laravel-boilerplate.
With the update to middleware with injecting dynamic parameters, and a acl that is provided, it is almost a must :)
from laravel-boilerplate.
Haha yes I haven't looked into all of the new features yet. But I'm sure they will all come in handy. I want it to be a boilerplate as well as a good learning tool for all the main components.
Anthony Rappa
On May 16, 2015, at 14:34, jekinney [email protected] wrote:
With the update to middleware with injecting dynamic parameters, and a acl that is provided, it is almost a must :)
—
Reply to this email directly or view it on GitHub.
from laravel-boilerplate.
__> - I decided to upgrade it myself :P - no problems so far.
from laravel-boilerplate.
Which guide did you use?
Anthony Rappa
On May 16, 2015, at 14:52, Christian [email protected] wrote:
__> - I decided to upgrade it myself :P - no problems so far.
—
Reply to this email directly or view it on GitHub.
from laravel-boilerplate.
i just used:
http://laravel.com/docs/master/upgrade
then i found issues with the blade extension since it removed "createPlainMatcher" in the blade compilers for you know.... reasons :/ - so now the matcher is:
$matcher = '/@endpermission/';
$matcher = '/@endrole/';
from laravel-boilerplate.
Also the Middleware now uses parameters so you could do something like this:
public function handle($request, Closure $next, $permissions = null)
from laravel-boilerplate.
Oh awesome I can get rid of some classes and make it simple now.
Anthony Rappa
On May 16, 2015, at 15:25, Christian [email protected] wrote:
Also the Middleware now uses parameters so you could do something like this:
public function handle($request, Closure $next, $permissions = null)
—
Reply to this email directly or view it on GitHub.
from laravel-boilerplate.
Do you know if theres updated docs for the features yet? I don't see them, I just want to see how the route params are implemented and such. I will push a feature branch tomorrow for you to test, but it seems the only thing I had to change was bootstrap.php and create a cache directory, nothing else should be effected, I think. I'm gonna try to get rid of the Registrar file too my moving the methods somewhere else, suggestions are welcome.
from laravel-boilerplate.
Middleware parameters:
https://laracasts.com/series/intermediate-laravel/episodes/8
not much has been re-done for laravel 5.1 but ill find some more things to check out.
from laravel-boilerplate.
also take a look at this compiler
http://laravel.com/api/5.0/Illuminate/View/Compilers/BladeCompiler.html
vs this compiler (5.1)
http://laravel.com/api/master/Illuminate/View/Compilers/BladeCompiler.html
as you can see they removed:
createPlainMatcher <- used in your Blade Access Extender
createOpenMatcher
createMatcher
Take a look at your user roles and permissions , try adding a permission, then removing one.
they changed this lists() method into a collection so to have they as an array, you would use lists()->all()
from laravel-boilerplate.
Ok i'll take a look. The bad thing is I'm not that good at writing tests, so there are none right now, I have to attempt to check each method call to make sure they work. I think I got the blade functions working from your previous comment, I think that was all that had to be done.
from laravel-boilerplate.
I'm not sure if I like the route middleware params, it doesn't seem flexible. For example, how would I pass an array as a parameter?
Edit: They're saying you can't, I could pass a JSON string and decode it in the middleware file, but that seems more complicated than it's worth.
from laravel-boilerplate.
i am also not good at writing tests, so what i usually do is test all functions like a normal consumer and see if something breaks, when it does, I can find where it is located... that's how it works for me.
Affected files that need to be changed to lists()->all()
App\Http\Controllers\Backend\Access\PermissionController.php
App\Http\Controllers\Backend\Access\RoleController.php
App\Http\Controllers\Backend\Access\UserController.php
so they would end with:
lists('id')->all()
yea for the middleware u can't pass it as an array, they added it but it was made into a simple function, im trying to see if they can do something about that, cause that's limiting on many factors.
I prefer to use my middleware in the controllers cause then things look a lot more clumpy in the routes.
from laravel-boilerplate.
Maybe, I prefer it in the routes so I can see it all at a glance, plus my middlewares don't work in the controllers. I don't know which way it should go, i'm not crazy about the parameters, as long as the way it works now is still going to work, why change it?
from laravel-boilerplate.
the way it works now is fine. The only reason is that it "doesnt" work in the controllers. So i fixed it up myself to work in the controllers. It works in the controllers but at the same time now it doesn't work in the routes (efficiently)
The middleware is pretty one sided, I liked the before/after filters back in 4.x >_>.
from laravel-boilerplate.
How did you implement it? Maybe I can make it work both ways.
from laravel-boilerplate.
not really much done:
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, $permission = null)
{
$assets = $this->getAssets($request);
if (! access()->canMultiple($permission, $assets['needsAll']))
{
return $this->getRedirectMethodAndGo($request);
}
return $next($request);
}
As i said it's pretty much one sided and will basically favor controllers....
This is basically the parameter within laravel:
/**
* Resolve the middleware name to a class name preserving passed parameters
*
* @param $name
* @return string
*/
public function resolveMiddlewareClassName($name)
{
$map = $this->middleware;
list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null);
return array_get($map, $name, $name).($parameters ? ':'.$parameters : '');
}
so in a controller it would be like this:
$this->middleware('access.routeNeedsPermission:testing_permission');
from laravel-boilerplate.
Why not do both? You can favor either or in the code.
public function handle($request, Closure $next, $permission = null)
{
$assets = $this->getAssets($request);
if (! access()->canMultiple(! is_null($permission) ? $permission : $assets['permissions'], $assets['needsAll']))
{
return $this->getRedirectMethodAndGo($request);
}
return $next($request);
}
from laravel-boilerplate.
Plus needsAll doesn't matter because you can't pass and array.
Edit: Or you can pass that as well. Permissions could be something like permission1|permission2, then do something like explode("|", $permission) to get the array of.
from laravel-boilerplate.
Did this quick, didn't test:
public function handle($request, Closure $next, $permissions = null, $needsAll = null)
{
$assets = $this->getAssets($request);
$permissions = ! is_null($permissions) ? (strpos($permissions, "|") !== false ? explode("|", $permissions) : $permissions) : $assets['permissions'];
$needsAll = ! is_null($needsAll) ? (bool)$needsAll : $assets['needsAll'];
if (! access()->canMultiple($permissions, $needsAll))
return $this->getRedirectMethodAndGo($request);
return $next($request);
}
from laravel-boilerplate.
this works:
$this->middleware('access.routeNeedsPermission:can_manage_news|can_manage_titles');
for route parameters you would have something like this:
[middleware => 'access.routeNeedsPermission:can_manage_news|can_manage_titles']
so you would in turn remove the:
'permssions' => [],
and instead use the one above.
from laravel-boilerplate.
the same would apply to the roles
from laravel-boilerplate.
though the NeedsRoleOrPermssion file was already confusing for me so i didnt touch it >_>
i think it would be something like this:
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, $roles = null, $permissions = null, $needsAll = null)
{
$assets = $this->getAssets($request);
$roles = ! is_null($roles) ? (strpos($roles, "|") !== false ? explode("|", $roles) : $roles) : $assets['roles'];
$permissions = ! is_null($permissions) ? (strpos($permissions, "|") !== false ? explode("|", $permissions) : $permissions) : $assets['permissions'];
$needsAll = ! is_null($needsAll) ? (bool)$needsAll : $assets['needsAll'];
if ($assets['needsAll']) {
if (! access()->hasRoles($roles, true) || ! access()->canMultiple($permissions, true))
return $this->getRedirectMethodAndGo($request);
} else {
if (! access()->hasRoles($roles, false) && ! access()->canMultiple($permissions, false))
return $this->getRedirectMethodAndGo($request);
}
return $next($request);
}
from laravel-boilerplate.
What confuses you about it? I can probably simplify it, but it's a combination of the other two files in one.
from laravel-boilerplate.
yea i noticed. I like to skim files so anything that seems really long i usually just don't like to deal with unless i need to.
(Not a fan of multiple lines of code thats if and else)
from laravel-boilerplate.
Im glad L5.1 will have LTS because if i have to do another major upgrade to like L5.5 or L6 (or something of that variation) and the folder structure changes..... i will destroy all frameworks.
from laravel-boilerplate.
Did they change the folder structure this time? I didn't see it in the upgrade docs.
from laravel-boilerplate.
na, i wa sreferring to the transition from L4 to L5.
They did change the Commands folder to Jobs so now its:
Jobs/Jobs.php
from laravel-boilerplate.
I guess that wasnt a required change to upgrade then.
I might do it anyway.
On May 17, 2015, at 16:13, Christian [email protected] wrote:
na, i wa sreferring to the transition from L4 to L5.
They did change the Commands folder to Jobs so now its:Jobs/Jobs.php
—
Reply to this email directly or view it on GitHub.
from laravel-boilerplate.
it's not "required" they just did it to implicate that its not a command more of a job. so not changing it wont do anything.
from laravel-boilerplate.
You can't pass an array per say into the middleware, but you can pass multiple parameters. Concatenate as many as you need separated by a colon (:) I believe.
from laravel-boilerplate.
Taylor is also working on the docs now. Switch to master from 5.0 and that is the 5.1 docs in work.
from laravel-boilerplate.
Here's the branch: https://github.com/rappasoft/laravel-5-boilerplate/tree/feature/upgrade_to_5.1
I'm not done but you can pull it and see if you see anything wrong. Read the commit notes for what I added.
from laravel-boilerplate.
works for me:
also did throttling ever get implemented?
from laravel-boilerplate.
Not yet, have to research the best way to do it. I'll probably reverse engineer the zizaco/Confide version.
from laravel-boilerplate.
Also, working on way to use the access middleware fully in both routes and controllers.
from laravel-boilerplate.
what do you mean by work both in routes and controllers. Dont they already work? I mean they work for me in the controllers.
from laravel-boilerplate.
All the parameters that come with the access library, for example:
Route::group([
'middleware' => 'access.routeNeedsRole',
'role' => ['Administrator'],
'redirect' => '/',
'with' => ['flash_danger', 'You do not have access to do that.']
], function ()
{
Route::get('dashboard', ['as' => 'backend.dashboard', 'uses' => 'DashboardController@index']);
require_once(__DIR__ . "/Routes/Backend/Access.php");
});
Will be able to be:
$this->middleware('access.routeNeedsRole:{role:Administrator,redirect:/,with:flash_danger|You do not have access to do that.}');
Instead of having the route group.
from laravel-boilerplate.
oh, the other stuff >_> - dint really like it. I was just mostly in it for the roles/permissions portion since it already redirects by itself.
from laravel-boilerplate.
It just gives more flexibility.
from laravel-boilerplate.
I have pushed all of the route/controller middleware updates: https://github.com/rappasoft/laravel-5-boilerplate/tree/feature/upgrade_to_5.1
from laravel-boilerplate.
Anything else you think I should change?
from laravel-boilerplate.
not at the moment.
from laravel-boilerplate.
Cool, when it goes stable i'll merge it and give it a 1.0 tag finally.
from laravel-boilerplate.
Hello,
Is the Throttling feature ready to use in this boilerplate? I just read that such feature is built in with L5.1 https://mattstauffer.co/blog/login-throttling-in-laravel-5.1
from laravel-boilerplate.
Any one?
from laravel-boilerplate.
Related Issues (20)
- Demo asking for password update HOT 2
- Default pages HOT 1
- /lang route will break the session if wrong... HOT 2
- Contact form gcaptcha wrong validate: v6.x HOT 2
- [JS Console Warning] AlphineJS loaded before Livewire scripts. HOT 8
- [Question] Automate generation of localization JSON data(__, @lang in template/classes) HOT 3
- Need to update from Laravel 6 BoilerPlate to Laravel 8 or 9 HOT 2
- I need to disable 2 step authentication HOT 2
- Password expiration middleware to exclude social logins HOT 3
- Argument 1 passed to Illuminate\Session\Middleware\StartSession::addCookieToResponse() must be an instance of Symfony\Component\HttpFoundation\Response, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php on line 63 {"exception":"[object] (Symfony\\Component\Debug\\Exception\\FatalThrowableError(code:0) HOT 1
- support laravel9? HOT 13
- Can't access the Demo server HOT 1
- Deactivated user can login by requesting password reset HOT 12
- Composer Install Package Issue HOT 2
- I got this error how to solve HOT 1
- Conflict in backend.js causing nav anchor tag to not append to URL HOT 3
- 2FA isn't working HOT 2
- Failed asserting HOT 2
- Demo is broken - Password reset required HOT 2
- support for laravel 11?
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 laravel-boilerplate.