mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-17 12:03:00 -04:00
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
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, $order)
|
|
{
|
|
$section = new Section();
|
|
$section->title = $title;
|
|
$section->layout = $layout;
|
|
$section->order = $order;
|
|
$section->save();
|
|
|
|
return $section;
|
|
}
|
|
|
|
public function update($id, $title, $layout, $order)
|
|
{
|
|
$section = Section::find($id);
|
|
|
|
if ($section) {
|
|
$section->title = $title;
|
|
$section->layout = $layout;
|
|
$section->order = $order;
|
|
$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);
|
|
}
|
|
}
|