StocksNew/Modules/Admin/app/Repositories/FieldRepository.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

49 lines
941 B
PHP

<?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);
}
}