コード例 #1
0
ファイル: Page.php プロジェクト: schlos/GreenAlert
 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();
 }
コード例 #3
0
 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.');
 }
コード例 #4
0
ファイル: HomeController.php プロジェクト: schlos/GreenAlert
 public function showAbout()
 {
     $about = Page::find(2);
     $data = compact('about');
     return view('home.about', $data);
 }