mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-17 21:03:00 -04:00
49 lines
991 B
PHP
49 lines
991 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)
|
|
{
|
|
$section = new Section();
|
|
$section->title = $title;
|
|
$section->layout = $layout;
|
|
$section->save();
|
|
|
|
return $section;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|