PHP code example of forest-lynx / moonshine-resource-lock
1. Go to this page and download the library: Download forest-lynx/moonshine-resource-lock library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
forest-lynx / moonshine-resource-lock example snippets
//...
use ForestLynx\MoonShine\Traits\WithResourceLock;
class PostResource extends ModelResource
{
use WithResourceLock;
//...
namespace App\Actions;
use ForestLynx\ResourceLock\Actions\ResourceLockOwnerAction;
class CustomActions extends ResourceLockOwnerAction
{
public function execute(Model|Authenticatable $user): ?string
{
return $user->email;
}
}
//...
class PostResource extends ModelResource
{
//...
use WithResourceLock;
//...
protected function getReturnUrlResourceLock(): string
{
return 'https://...';
}
//...
}
//...
class PostResource extends ModelResource
{
//...
use WithResourceLock;
//...
public function isDisplayOnIndexPage(): bool
{
return false;
}
//...
}