Coder Social home page Coder Social logo

arcesilas / active-state Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 103 KB

Laravel link active state helper based on URL, route or query string

License: MIT License

PHP 98.47% HTML 1.53%
active active-helper helper laravel link menu query request route url

active-state's People

Contributors

garbinmarcelo avatar llaski avatar nayzawoo avatar nyanwin avatar pyaesone17 avatar scrutinizer-auto-fixer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

active-state's Issues

ifRouteIs in the server

Hello, how are you?

I'm facing a problem, in my localhost the command {{ Active::ifRouteIs('site.cardapio', 'pizzas']) }} is working normally, but when I uploaded the project to a shared server it does not seem to work to function.

I use 2 methods in the menu, the "ifRouteIn" which is working normally and the "ifRouteIs" that is not, however the 2 work normal in localhost.

Do you have any suggestions whatsoever?

ifQueryHas - Array to string conversion

Hello, how are you? I am trying to use the ifQueryHas method.
Laravel v5.5.48
active-state v2.1.0

I tried to follow this README example:

Check query string contains argument foo with value bar:
<a class="nav-link {{Active::ifQueryHas('videos.category', ['slug' => $category->slug])}}" href="{{ route('videos.category', $category->slug) }}">

Then returns me the following error:
image

my tag: <a class="nav-link {{Active::ifQueryHas('site.noticias.listar', ['pagina' => $noticias->currentPage()])}}" href="#">test</a>

I'm trying to use the package with a pagination that involves categories and search. I don't know if I'm doing it the right way. If so, could you inform me? thanks

Class 'Arcesilas\ActiveState\ActiveStateServiceProvider' not found

I am using version 1.2 with Laravel 5.4

I have installed according to the instructions and added

'providers' => [
    ...
    Arcesilas\ActiveState\ActiveStateServiceProvider::class,
]

to config/app.php

but I am receiving the error Class 'Arcesilas\ActiveState\ActiveStateServiceProvider' not found

array in ifRouteIs not working

Hello friend,
I'm using the package, however I realized that the "ifRouteIs" method is not working when used array.
Even though the route exists, validation is passed as if it does not exist.
I was even trying to make code changes, but I do not know how to cross-test in PHP.

CheckRoute

Hello,
I started using your package...
the "Active::checkRoute()" method is working?

I did this test: {{ Active::checkRoute('user.index') }}

But returned:
ErrorException (E_ERROR) Call to undefined method Arcesilas\ActiveState\Active::checkRoute()

What can it be?

Class name

Doubt over class name configuration pass.

Would it be possible to pass the class name when calling the method? Example:

<li class="{{ Active::ifRouteIn('site.index', 'current') }}"><a href="{{ url('/') }}" title="Início"><div>Início</div></a></li>

[Question] checkUrlIs does not ignore query parameters? (and are there negated helper methods?)

Hi,

I just noticed that

https://test.localhost/notifications

and

https://test.localhost/notifications?all=1

return for

{{ active_url_is('notifications') }}

both the active string.

May it be that query params are not part of the exact url check? I would like to differentiate between the path without and with query parameters. Is there something for that use case?

In the lib at line

return $this->request->is(...$patterns);
the Laravel HTTP Request is() method is used. The Laravel is() method makes use of a string comparison with http://php.net/manual/en/function.rawurldecode.php at https://github.com/laravel/framework/blob/2906b572aa83ff46b8ad57093dd0e859c0ff783f/src/Illuminate/Http/Request.php#L148

And if I see that right, the url should be the whole thing.

Active::checkRouteIs() with array of routes

Currently, Active::checkRouteIs() accepts an array of routes, but the format of the array is a little complex, in my opinion, for an actual use in a view:

[
    'some.route' => ['slug' => 'something'],
    'route.test' => ['slug' => 'title']
]

@marcelogarbin do you think this usage is relevant?

Personnally, I think it's not really usable in a view and am considering to remove this functionnality. What do you think?

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.