• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

php-casbin / laravel-authz / 13525052277

25 Feb 2025 03:38PM UTC coverage: 99.248%. Remained the same
13525052277

Pull #81

github

web-flow
Merge ae49f18c4 into 2df3d03ed
Pull Request #81: feat: Laravel 12.x Compatibility

264 of 266 relevant lines covered (99.25%)

120.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Commands/GroupAdd.php
1
<?php
2

3
namespace Lauthz\Commands;
4

5
use Illuminate\Console\Command;
6
use Lauthz\Facades\Enforcer;
7

8
/**
9
 * PolicyAdd class.
10
 */
11
class GroupAdd extends Command
12
{
13
    /**
14
     * The name and signature of the console command.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'group:add
19
                            {policy : the rule separated by commas}';
20

21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Adds a role inheritance rule to the current policy.';
27

28
    /**
29
     * Execute the console command.
30
     *
31
     * @return mixed
32
     */
33
    public function handle()
34
    {
35
        $params = explode(',', $this->argument('policy'));
9✔
36
        array_walk($params, static function (&$value): void {
9✔
37
            $value = trim($value);
9✔
38
        });
9✔
39
        $ret = Enforcer::addGroupingPolicy(...$params);
9✔
40
        if ($ret) {
9✔
41
            $this->info('Grouping `' . implode(', ', $params) . '` created');
9✔
42
        } else {
43
            $this->error('Grouping `' . implode(', ', $params) . '` creation failed');
9✔
44
        }
45

46
        return $ret ? 0 : 1;
9✔
47
    }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc