protected function bootObservers() { Block::observe(BlockObserver::class); Page::observe(PageObserver::class); BlockType::observe(DynamicObserver::class); PageType::observe(DynamicObserver::class); }
public function index() { $filter = $this->buildFilter(); $grid = $this->buildGrid($filter); $grid->paginate(10)->getGrid($this->getGridView()); $block_types = BlockType::get(); return view($this->getView('index'), ['filter' => $filter, 'grid' => $grid, 'hint' => $this->hint, 'block_types' => $block_types]); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * * @return mixed */ public function handle($request, Closure $next, $guard = null) { config()->set('auth.defaults.guard', 'soda'); //this is a work around for a laravel bug - the guard flicks back to the default when run through an auth Gate //so we need to temporarily set the guard to the incomming guard here instead. Block::disableDrafts(); BlockType::disableDrafts(); Page::disableDrafts(); PageType::disableDrafts(); return $next($request); }
/** * Work In Progress * Returns a view for an inline editable field * * @param $model * @param $element * @param $type * * @return \Illuminate\View\View */ public function editable($model, $element, $type) { $field_value = $model->{$element}; if (Request::get('soda_edit')) { $unique = uniqid(); if ($model instanceof ModelBuilder) { //we need to get the db name and attach to the field.. $type = BlockType::where('identifier', $type)->first(); $link = route('soda.dyn.inline.edit', ['type' => $type->identifier, 'model' => $model->id, 'field' => $element]); } //TODO: figure out which type of field we need to use here.. return view('soda::inputs.inline.text', ['link' => $link, 'element' => $element, 'model' => $model, 'unique' => $unique, 'field_value' => $field_value]); } else { return $field_value; } }
/** * Auto generated seed file * * @return void */ public function run() { $application = Application::first(); $slider = BlockType::create(['name' => 'Slider', 'description' => 'Slides to appear in a slider plugin', 'application_id' => $application->id, 'action' => 'partials.sections.slider', 'action_type' => 'view', 'package' => 'sodacms', 'identifier' => 'slider', 'status' => Status::LIVE, 'edit_action' => 'view', 'edit_action_type' => 'soda::blocks.index']); }