Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Config publish functionality. #6

Merged
merged 4 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions resources/views/crudboard/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<div class="card">
<div class="card-header">
<h5 class="card-title">
@if($show->getTitle())
{{ $show->getTitle() }}
@if($show->getTitle())
{{ $show->getTitle() }}
@else
{{ $attributes['title']}}
{{ $attributes['title']}}
@endif
</h5>
</div>
Expand All @@ -21,8 +21,11 @@
@php
$value = $field->getValue() ;
$record = $show->getRecord();
if($formaterFunc = $field->getFormatValueCallable()){
$value = $formaterFunc($value,$record);
}
@endphp
<x-dynamic-component :component="$component" :$value :$record />
<x-dynamic-component :component="$component" :$value :$record/>
@else
{{$field->getValue()}}
@endif
Expand Down
28 changes: 14 additions & 14 deletions src/Admin.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
namespace CodeCoz\AimAdmin;
class Admin
{
// Build wonderful Aim Admin Package
public static function packagePath($path): string
{
return __DIR__ . "/../$path";
}
}
<?php

namespace CodeCoz\AimAdmin;

class Admin
{
// Build wonderful Aim Admin Package

public static function packagePath($path): string
{
return __DIR__ . "/../$path";
}

}
24 changes: 12 additions & 12 deletions src/AdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function register(): void
$this->interfacesBindings();

// Register user service provider.
// $this->app->register(UserServiceProvider::class);
// $this->app->register(UserServiceProvider::class);

// Register the Menu service provider.
$this->app->register(MenuServiceProvider::class);
Expand All @@ -72,15 +72,15 @@ protected function registerBladeExtensions($bladeCompiler): void
{
$bladeMethodWrapper = '\\CodeCoz\\AimAdmin\\AdminServiceProvider::bladeMethodWrapper';

$bladeCompiler->directive('hasanypermission', fn($args) => "<?php if({$bladeMethodWrapper}('hasAnyPermission', {$args})): ?>");
$bladeCompiler->directive('elsehasanypermission', fn($args) => "<?php elseif({$bladeMethodWrapper}('hasAnyPermission', {$args})): ?>");
$bladeCompiler->directive('endhasanypermission', fn() => '<?php endif; ?>');
$bladeCompiler->directive('hasanypermission', fn ($args) => "<?php if({$bladeMethodWrapper}('hasAnyPermission', {$args})): ?>");
$bladeCompiler->directive('elsehasanypermission', fn ($args) => "<?php elseif({$bladeMethodWrapper}('hasAnyPermission', {$args})): ?>");
$bladeCompiler->directive('endhasanypermission', fn () => '<?php endif; ?>');

$bladeCompiler->directive('hasrole', fn($args) => "<?php if({$bladeMethodWrapper}('hasRole', {$args})): ?>");
$bladeCompiler->directive('endhasrole', fn() => '<?php endif; ?>');
$bladeCompiler->directive('hasrole', fn ($args) => "<?php if({$bladeMethodWrapper}('hasRole', {$args})): ?>");
$bladeCompiler->directive('endhasrole', fn () => '<?php endif; ?>');

$bladeCompiler->directive('hasanyrole', fn($args) => "<?php if({$bladeMethodWrapper}('hasAnyRole', {$args})): ?>");
$bladeCompiler->directive('endhasanyrole', fn() => '<?php endif; ?>');
$bladeCompiler->directive('hasanyrole', fn ($args) => "<?php if({$bladeMethodWrapper}('hasAnyRole', {$args})): ?>");
$bladeCompiler->directive('endhasanyrole', fn () => '<?php endif; ?>');

}

Expand All @@ -98,7 +98,7 @@ private function interfacesBindings(): void
{
// Register the service the package provides.
$this->app->singleton($this->packagePrefix, function ($app) {
return new Admin;
return new Admin();
});

// Register the extra Interfaces to the package provides.
Expand Down Expand Up @@ -199,9 +199,9 @@ private function loadMigration(): void
*/
private function registerGlobalMiddleware(): void
{
// $this->app['router']->aliasMiddleware('role', RoleMiddleware::class);
// $this->app['router']->aliasMiddleware('acl', CheckPermission::class);
// $this->app['router']->pushMiddlewareToGroup('web', ForcePasswordChange::class);
// $this->app['router']->aliasMiddleware('role', RoleMiddleware::class);
// $this->app['router']->aliasMiddleware('acl', CheckPermission::class);
// $this->app['router']->pushMiddlewareToGroup('web', ForcePasswordChange::class);
}

/**
Expand Down
125 changes: 63 additions & 62 deletions src/Collection/AbstractCollection.php
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
<?php declare(strict_types=1);

/*
* This file is part of the Aim Admin package.
*
* (c) CodeCoz <contact@codecoz.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CodeCoz\AimAdmin\Collection;


/**
* This class is a collection abstract class abstract.
*
* @author CodeCoz <contact@codecoz.com>
*/
abstract class AbstractCollection implements \ArrayAccess, \Countable, \IteratorAggregate
{
protected array $items;

abstract function offsetGet(mixed $offset): mixed;

public function isEmpty(): bool
{
return 0 === \count($this->items);
}

public function offsetExists(mixed $offset): bool
{
return \array_key_exists($offset, $this->items);
}


public function offsetSet(mixed $offset, mixed $value): void
{
$this->items[$offset] = $value;
}

public function offsetUnset(mixed $offset): void
{
unset($this->items[$offset]);
}

public function getIterator(): \ArrayIterator
{
return new \ArrayIterator($this->items);
}

public function count(): int
{
return \count($this->items);
}

public function all(): array
{
return $this->items;
}

}
<?php

declare(strict_types=1);

/*
* This file is part of the Aim Admin package.
*
* (c) CodeCoz <contact@codecoz.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CodeCoz\AimAdmin\Collection;

/**
* This class is a collection abstract class abstract.
*
* @author CodeCoz <contact@codecoz.com>
*/
abstract class AbstractCollection implements \ArrayAccess, \Countable, \IteratorAggregate
{
protected array $items;

abstract public function offsetGet(mixed $offset): mixed;

public function isEmpty(): bool
{
return 0 === \count($this->items);
}

public function offsetExists(mixed $offset): bool
{
return \array_key_exists($offset, $this->items);
}


public function offsetSet(mixed $offset, mixed $value): void
{
$this->items[$offset] = $value;
}

public function offsetUnset(mixed $offset): void
{
unset($this->items[$offset]);
}

public function getIterator(): \ArrayIterator
{
return new \ArrayIterator($this->items);
}

public function count(): int
{
return \count($this->items);
}

public function all(): array
{
return $this->items;
}

}
Loading
Loading