1. Go to this page and download the library: Download miciew/eloquent-options 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/ */
miciew / eloquent-options example snippets
public function ban()
{
$this->setOption('ban', true);
return $this;
}
public function unBan()
{
$this->setOption('ban', false);
return $this;
}
public function isBan()
{
$default = false;
return $this->getOptionValue('ban', $default);
}
use Miciew\Laravel\Option\Traits\HasOptions;
class Article
{
use HasOptions;
}
public function options(): morphMany;
public function setOption($name, $value = null): null|Option;
public function getOption($name, $default = null): null|Option;
public function getOptionValue($name, $default = null): mix;