You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
787 B
38 lines
787 B
<?php
|
|
|
|
namespace App\Entities\Options;
|
|
|
|
use App\Entities\BaseRepository;
|
|
use App\Exceptions\OptionNotFoundException;
|
|
use App\Exceptions\OptionUpdateException;
|
|
use App\Exceptions\OptionDeleteException;
|
|
|
|
/**
|
|
* Options Repository Class
|
|
*/
|
|
class OptionsRepository extends BaseRepository
|
|
{
|
|
protected $model;
|
|
|
|
public function __construct(Option $model)
|
|
{
|
|
parent::__construct($model);
|
|
}
|
|
|
|
public function getAll($q = null)
|
|
{
|
|
return Option::all();
|
|
}
|
|
|
|
public function save($optionsData)
|
|
{
|
|
$options = $this->getAll();
|
|
foreach ($optionsData as $key => $value) {
|
|
$option = $options->where('key', $key)->first();
|
|
$option->value = $value;
|
|
$option->save();
|
|
}
|
|
|
|
return 'saved';
|
|
}
|
|
}
|