/** * @return bool|Page */ public function handle() { $this->page->fill($this->input); return $this->page->save() ? $this->page : false; }
/** * @param Request $request * @param Page $page */ public function batchUnpublish(Request $request, Page $page) { $ids = $request->get('pages', []); if (is_array($ids) && count($ids)) { $pages = $page->whereIn('pages.id', $ids)->get(); foreach ($pages as $page) { $translation = $page->translate($request->get('locale')); if ($translation) { $translation->published = false; } $translation->save(); } } }
/** * @param Page $post */ public function creating(Page $post) { if (!$post->user_id) { $post->user()->associate($this->auth->user()); } }