/** * CMS constructor. */ public function __construct() { $this->lang = App::getLocale(); $this->path = str_replace('/', '#', Request::path()); $this->blocks = Block::where('language', $this->lang)->where('path', $this->path)->select('content', 'block')->get()->keyBy('block')->toArray(); }
public function updateBlock(Request $request) { $block = Block::firstOrCreate($request->only(['path', 'block', 'language'])); $block->update(['content' => $request->input('content')]); return $request->only(['path', 'block', 'language']); }