mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-17 21:03:00 -04:00
47 lines
944 B
PHP
47 lines
944 B
PHP
<?php
|
|
|
|
namespace Modules\Frontend\Repositories;
|
|
|
|
use Modules\Frontend\Entities\Section;
|
|
use Modules\Frontend\Entities\SectionCategory;
|
|
use Modules\Frontend\Entities\SectionItem;
|
|
|
|
class SectionRepository
|
|
{
|
|
public function all()
|
|
{
|
|
return Section::all();
|
|
}
|
|
|
|
public function create($title, $layout)
|
|
{
|
|
return Section::create([
|
|
'title' => $title,
|
|
'layout' => $layout,
|
|
]);
|
|
}
|
|
|
|
public function update($id, $title, $layout)
|
|
{
|
|
$section = Section::find($id);
|
|
|
|
if ($section) {
|
|
$section->title = $title;
|
|
$section->layout = $layout;
|
|
$section->update();
|
|
|
|
return $section;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
SectionItem::where('section_id', $id)->delete();
|
|
SectionCategory::where('section_id', $id)->delete();
|
|
|
|
return Section::destroy($id);
|
|
}
|
|
}
|