/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('cms_menus', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
         $table->string('slug', 255);
         $table->string('title', 255);
         $table->integer('edit_order');
     });
     \Cms\Models\Menu::create(array("slug" => "main-menu", "title" => "Main menu", "edit_order" => 10));
     Schema::create('cms_pages', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
         $table->dateTime('publish_start');
         $table->dateTime('publish_end');
         $table->integer('is_home');
         $table->integer('menu_id');
         $table->integer('allow_dropdown');
         $table->integer('parent_id');
         $table->string('link', 150);
         $table->string('slug', 150);
         $table->string('url', 100);
         $table->string('controller', 100);
         $table->string('template', 255);
         $table->integer('order');
         $table->integer('published');
         $table->integer('crawled');
     });
     Schema::create('cms_page_content', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
         $table->integer('page_id');
         $table->integer('removed');
         $table->string('title', 255);
         $table->longText('body');
     });
     Schema::create('cms_settings', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
         $table->string('name', 100);
         $table->string('value', 255);
     });
     Cms\Models\Setting::create(array("name" => "datepicker_format", "value" => "yyyy-MM-dd hh:mm:ss"));
     Cms\Models\Setting::create(array("name" => "extend_url_template_page", "value" => "cms::layouts.page"));
     Cms\Models\Setting::create(array("name" => "content_section_name", "value" => "content"));
     Schema::create('cms_users', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
         $table->string('username', 30);
         $table->string('password', 68);
         $table->smallInteger('edit');
         $table->smallInteger('admin');
         $table->string('remember_token', 100)->nullable();
     });
     \Cms\Models\User::create(array("username" => "admin", "password" => Hash::make("admin"), "edit" => 1, "admin" => 1));
 }
예제 #2
0
 public function saveUser($userId = 0)
 {
     $data = array("username" => Input::get('username'), "edit" => Input::get('edit') ? true : false, "admin" => Input::get('admin') ? true : false);
     if (Input::get('password')) {
         $data['password'] = Hash::make(Input::get('password'));
     }
     if ($userId) {
         $user = \Cms\Models\User::where("id", "=", $userId)->update($data);
     } else {
         $user = \Cms\Models\User::create($data);
     }
     return Redirect::route('users')->with('flash_notice', Lang::get('cms::m.saved'));
 }