first commit
This commit is contained in:
48
Modules/Admin/app/Repositories/FieldRepository.php
Normal file
48
Modules/Admin/app/Repositories/FieldRepository.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Field;
|
||||
|
||||
class FieldRepository implements FieldInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Field::get();
|
||||
}
|
||||
|
||||
public function getFieldById($FieldId)
|
||||
{
|
||||
return Field::findOrFail($FieldId);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return Field::pluck('title', 'id');
|
||||
}
|
||||
|
||||
public function getDropdownByAlias($alias)
|
||||
{
|
||||
$fieldModel = Field::where("alias", $alias)->first();
|
||||
if ($fieldModel) {
|
||||
return $fieldModel->dropdown()->pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete($FieldId)
|
||||
{
|
||||
Field::destroy($FieldId);
|
||||
}
|
||||
|
||||
public function create(array $FieldDetails)
|
||||
{
|
||||
return Field::create($FieldDetails);
|
||||
}
|
||||
|
||||
public function update($FieldId, array $newDetails)
|
||||
{
|
||||
return Field::where('id', $FieldId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user