1. Go to this page and download the library: Download zvermafia/larastate 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/ */
zvermafia / larastate example snippets
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
// ... other validation rules
'role' => [
'
// app/States/UserState.php
namespace App\States\UserState;
use Zvermafia\Larastate\Abstracts\StateAbstract;
class UserState extends StateAbstract
{
/** @var array */
public const ROLE = [
'member' => 'member',
'moderator' => 'moderator',
'administrator' => 'administrator',
];
}
/**
* Get the validation rules that apply to the request.
*
* @param \App\States\UserState $user_states
* @return array
*/
public function rules(UserState $user_states)
{
return [
// ... other validation rules
'role' => [
'