public static function boot() { parent::boot(); // Setup event bindings... Page::created(function ($alertuser) { }); }
/** * Reverse the migrations. * * @return void */ public function down() { $about = Page::find(2); DB::table('pages')->truncate(); Schema::table('pages', function (Blueprint $table) { // $table->dropColumn('data'); $table->string('title')->nullable(); $table->longText('description')->nullable(); }); // Add Page using Eloquent $page = new Page(); $page->slug = 'about'; $page->title = $about->data->title; $page->description = $about->data->description; $page->save(); }
public function setPages() { $input = json_decode(json_encode(\Input::all()), false); $home = Page::find(1); $home->data = $input->home; $home->save(); $about = Page::find(2); $about->data = $input->about; $about->save(); return redirect('dashboard/pages')->with('success', 'Successfully saved pages.'); }
public function showAbout() { $about = Page::find(2); $data = compact('about'); return view('home.about', $data); }