irsyadulibad/laravel-activehelper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

irsyadulibad/laravel-activehelper

Composer 安装命令:

composer create-project irsyadulibad/laravel-activehelper

包简介

Active State Helper for Laravel Blade

README 文档

README

Active State Helper for Laravel Blade

Lightweight and simple


GitHub GitHub repo size Hits


Introduction

Basically we do like this.

<li class="sidebar {{ Request::is('post') ? 'active' : 'no' }} ">Post</li>
<li class="sidebar {{ Request::is('page') ? 'active' : 'no' }} ">Page</li>

It would be nice if we can make shorter. right ?

<li class="sidebar @active('post')">Post</li>
<li class="sidebar @active('page.index')">Page</li>

Installation

Installation is best done via composer:

composer require irsyadulibad/laravel-activehelper

Add the service provider in config/app.php

'providers' => [
  .....,
  Irsyadulibad\LaravelActivehelper\ActiveHelperServiceProvider::class,
]

Usage

It will check the name of the currently active route. If match, it will return active string

<li class="sidebar @active('post')">Post</li>

Nested State

You can also do it on nested navbar items,in some case you need to grouping the item by category or model name

<li class="nav-item @active('user')">
  <a href="#">User</a>
  <ul>
    <li class="nav-link @active('user.index')">
      <a href="#">List Users</a>
    </li>
    <li class="nav-link @active('user.create')">
      <a href="#">Add User</a>
    </li>
</li>

More States

To check for more than one match states, you can add comma to the parameter

@active('user.index,post.create')

Author's Profile:

Github: [https://github.com/irsyadulibad]
Website: [http://irsyadulibad.my.id]
Facebook: [https://facebook.com/irsyadulibad.dev]

统计信息

  • 总下载量: 1.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固