mirror of
https://github.com/archtechx/livewire-access.git
synced 2025-12-12 12:24:03 +00:00
initial
This commit is contained in:
parent
a29235253b
commit
e50e22434f
12 changed files with 159 additions and 138 deletions
12
src/FrontendAccess.php
Normal file
12
src/FrontendAccess.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lean\LivewireAccess;
|
||||
|
||||
use Attribute;
|
||||
|
||||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD)]
|
||||
class FrontendAccess
|
||||
{
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Package;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class PackageServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
// $this->loadViewsFrom(__DIR__ . '/../assets/views', 'package');
|
||||
|
||||
// $this->publishes([
|
||||
// __DIR__ . '/../assets/views' => resource_path('views/vendor/package'),
|
||||
// ], 'package-views');
|
||||
|
||||
// $this->mergeConfigFrom(
|
||||
// __DIR__ . '/../assets/package.php',
|
||||
// 'package'
|
||||
// );
|
||||
|
||||
// $this->publishes([
|
||||
// __DIR__ . '/../assets/package.php' => config_path('package.php'),
|
||||
// ], 'package-config');
|
||||
}
|
||||
}
|
||||
23
src/WithExplicitAccess.php
Normal file
23
src/WithExplicitAccess.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lean\LivewireAccess;
|
||||
|
||||
use ReflectionMethod;
|
||||
use ReflectionProperty;
|
||||
|
||||
trait WithExplicitAccess
|
||||
{
|
||||
protected function methodIsPublicAndNotDefinedOnBaseClass($methodName)
|
||||
{
|
||||
return parent::methodIsPublicAndNotDefinedOnBaseClass($methodName)
|
||||
&& count((new ReflectionMethod($this, $methodName))->getAttributes(FrontendAccess::class)) > 0;
|
||||
}
|
||||
|
||||
public function propertyIsPublicAndNotDefinedOnBaseClass($propertyName)
|
||||
{
|
||||
return parent::propertyIsPublicAndNotDefinedOnBaseClass($propertyName)
|
||||
&& count((new ReflectionProperty($this, $propertyName))->getAttributes(FrontendAccess::class)) > 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue