Giter VIP home page Giter VIP logo

active's People

Contributors

buraksh avatar ilumos avatar jamesking56 avatar letrunghieu avatar lloricode avatar lowerends avatar mattrandallbecker avatar sebastienheyd avatar timgreenwood avatar valorin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

active's Issues

Feature: exclude possible routes from pattern

I'm encountering a use case where I need a pattern to match except for a specific URL. For example, I want the pattern 'users*' to match except for 'users/all'. If I'm not mistaken, this is not possible yet with this package, so I'm looking for feedback whether it would be useful to add this.

Thanks!

Watson conflict slows composer a lot

I don't know why exactly, but composer update spends a lot (lot lot) a time reading and writing cache from watson/active package.

It's really sad because as a conflict it should simply be ignored.

I still don't know what you can do about it, but maybe a simple warning should be better than this network lag on each composer update.

Feature: third argument to return for when route does not match pattern

A nice feature would be to have the possibility to add a third argument that would be returned in case the route does not match the given pattern. For example:

# Return string 'selected' if current URI is /foo or /bar or return string 'not-selected' if current URI is not /foo and not /bar
Active::pattern(array('foo', 'bar'), 'selected', 'not-selected');

Would this be something you would consider to add? I'd be glad to help with a pull request!

Error in documentation in - "Check the route parameter value"

Hi! I think that this package is nice.

I did find an error in your documentation at your website though. Just a mistake.
https://www.hieule.info/products/laravel-active-version-3-released/

It is under the header:

Check the route parameter value

  • Use the alias: Active::checkRouteParam($key, $value)
  • Use the application container: app('active')->checkRouteParam($key, $value)
  • Use the helper function: if_route_pattern($key, $value)

The third line is wrong and should be:

  • Use the helper function: if_route_param($key, $value)

the error is _pattern instead of _param like it should be

How to handle model binding route??

If I have bound the route param to route, eg: /{course}/{episode}, and episode bound with episode model

if_route_param('episode', $episode) will return null.

$this->route->parameter($param) will return the episode model, and it don't equal $episode model

Laravel 7.0

Hi @letrunghieu

Would it be possible to update your package(s) to support the newly released Laravel 7?

Thanks!

laravel 5.6

Hi, is this can use for laravel 5.6?

Best Regards,

Laravel 5?

Is this package going to be updated for Laravel 5?

Route parameters?

I think it would be a good idea to include the route parameters and not only the route name.

Lets say we need to set an active class for the route admin/product-types/{product_types}/categories.

We can do something like (not a very good example but hopefully you get the point):
Active::route(['admin.product-types.categories.index' => [$product_type->id]])

Bug in the template for error 404, 500, etc. ...

Hi,
My laravel app uses a global layout and Active::pattern in order to render my global menubar.

Since I try to implement my own 404 error pages, I met a bug :
Everywhere I use pattern, instead of returning active or false, Active facade seems to render recursively a 404 error page itself.

Did i miss something ?

change active class name

what if i wanna change the class name ? i want to use menu-activr class instead of active how to make this ?

pattern not working

Thanks for the script.

Problem

when I'm on /dragonfire1119 route and try
Active::pattern(Auth::user()->username);
it doesn't return active.

Example of a working solution

Request::is(Auth::user()->username) ? 'active' : ''
This works just fine.

Make compatible with Laravel 4.2

Hi,

Is it possible to make this package compatible with Laravel 4.2? The current composer requirements don't seem to allow Laravel 4.2.x.

Thanks

Another call and it breaks

I'm going to / but I'm also calling api/v1/posts which makes

uri
GET api/v1/post
name
api.v1.post.index

It changes the uri and name so the only thing that works right now is

{{ Request::is('/') ? 'active' : '' }}

Active::methods need to be static?

I'm trying to call Active::route('routename') in my view and get:

Non-static method HieuLe\Active\Active::route() should not be called statically, assuming $this from incompatible context ...

I tried to just rewrite the functions with static methods but that led to the router needing to be instantiated so I wasn't sure what to do from there.

`pattern` method check wrong input

The Active::pattern method will return wrong result if the current rout has ant parameters. This is found when I am trying to resolve issue #2.

Laravel 5.4 support

In the current version, you still have a reference to app->share in your service provider.

I see that the development version is using the app->singleton method. Could you release an update to get compatibility with L5.4?

Error when viewing 404

Hi @letrunghieu,

Thanks for creating this! When visiting a 404 page, I get the following error:

TypeError
in_array(): Argument #2 ($haystack) must be of type array, string given (View: navbar.blade.php)

Any chance you could fix this please, only happens for if_route_pattern

Update from 2.x to 3.x

I just tried to update my active version from 2.3.x to the latest release 3.x.

Well, this can be 'painful' if you work on a big project with a lot of uses of the package.

  • Active has been "rewritten with a absolutely new API", it mean you'll need to update all the method name you used (like Active::Pattern as example).
  • Again, the new methods dont accept a stringas parameter. Only an arrayeven if you only have one single value to check with. So after updating the methods, you'll need to update your stringparameters to arrays. It has been reported at #28
  • Some methods dont return an 'active' string defautly, but a true/false (1/0) as explained at #29

After discovering the implication of thisupdate, I decided to move back to my previous 2.x version. I think the string/array or the 'active' issues could be updated to match the functionnal 2.x behavior, but i may be wrong.

Anyway, 3.x updates seems pretty cool, from what i've tested and read.

ps: some infos could be partially or fully wrong, be sure that i love this awesome package !

Unresolvable dependency resolving

I use L5, added in composer.json
"hieu-le/active": "~2.0"

Append this line to your providers array in config/app.php
'HieuLe\Active\ActiveServiceProvider',
Append this line to your aliases array in config/app.php
'Active' => 'HieuLe\Active\Facades\Active',

L5 return:

BindingResolutionException in Container.php line 872: Unresolvable dependency resolving [Parameter #0 [ $app ]] in class Illuminate\Support\ServiceProvider

建议增加 if_query_pattern

[Proposal] Add if_query_pattern function

Some libraries use a complex combination of parameter's values.

For example:
RequestCriteria of andersao/l5-repository

http://prettus.local/users?filter=id;name

The values (id and name as well as others) of filter could be dynamic combination.
Can not easily be matched by if_query.

Active 2.0 Laravel 5 action issue

I'm not sure if this is new for Laravel 5 or what, but specifically with this code

Active.php

public function action($actions, $class = 'active')

$routeAction = $this->_router->currentRouteAction();

$this->_router->currentRouteAction() returns the full path of the action

i.e. (App\Http\Controllers\MyController@index rather than MyController@index)

So when using Active::action('MyController@index') it will fail when following the documentation.

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.