Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $application = Application::create(['name' => 'Soda']);
     $application_url = ApplicationUrl::create(['application_id' => $application->id, 'domain' => 'soda.dev', 'folder' => '']);
     $user = User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => \Hash::make('password')]);
     $role_global_admin = Role::create(['name' => 'global_admin', 'display_name' => 'Global Administrator', 'description' => 'User is the administrator of all applications', 'application_id' => $application->id]);
     $role_admin = Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'User is the administrator of a given application', 'application_id' => $application->id]);
     $role_user = Role::create(['name' => 'user', 'display_name' => 'User', 'description' => 'Standard user (authenticated)', 'application_id' => $application->id]);
     $role_guest = Role::create(['name' => 'guest', 'display_name' => 'Guest', 'description' => 'Unauthenticated user', 'application_id' => $application->id]);
     $basic_admin = Permission::create(['name' => 'basic-admin', 'display_name' => 'Basic Admin', 'description' => 'User can access basic admin features', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_own_permissions = Permission::create(['name' => 'manage-own-permissions', 'display_name' => 'Manage own permissions', 'description' => 'User can manage own permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_permissions = Permission::create(['name' => 'manage-permissions', 'display_name' => 'Manage permissions', 'description' => 'User can manage permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_groups = Permission::create(['name' => 'manage-roles', 'display_name' => 'Manage roles', 'description' => 'User can manage roles', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_users = Permission::create(['name' => 'manage-users', 'display_name' => 'Manage users', 'description' => 'User can manage users', 'section' => 'admin', 'application_id' => $application->id]);
     $user->applications()->attach($application);
     $role_global_admin->attachPermission($basic_admin);
     $role_global_admin->attachPermission($manage_own_permissions);
     $role_global_admin->attachPermission($manage_permissions);
     $role_global_admin->attachPermission($manage_groups);
     $role_global_admin->attachPermission($manage_users);
     $role_admin->attachPermission($basic_admin);
     $role_admin->attachPermission($manage_own_permissions);
     $role_admin->attachPermission($manage_permissions);
     $role_admin->attachPermission($manage_groups);
     $role_admin->attachPermission($manage_users);
     $user->attachRole($role_global_admin);
 }
Example #2
0
 protected function loadCurrentApplication()
 {
     if ($this->app->runningInConsole()) {
         $application = new Application(['name' => 'Soda CMS']);
         $application->url = new ApplicationUrl(['domain' => 'soda.dev', 'folder' => '']);
     } else {
         $application = Application::with('url')->whereHas('url', function ($q) {
             $domain = $this->app->request->getHttpHost();
             $q->where('domain', $domain)->where(function ($sq) {
                 $folder = $this->app->request->segment(1) == null ? '' : $this->app->request->segment(1);
                 $sq->where('folder', $folder)->orWhere('folder', '');
             })->orderBy('folder', 'DESC');
         })->first();
     }
     $this->application = $application;
     return $this;
 }
 /**
  * Auto generated seed file
  *
  * @return void
  */
 public function run()
 {
     $application = Application::create(['name' => 'Soda CMS']);
     ApplicationUrl::create(['domain' => 'localhost:8000', 'application_id' => $application->id]);
 }
Example #4
0
 /**
  * Auto generated seed file
  *
  * @return void
  */
 public function run()
 {
     $application = Application::first();
     $slider = BlockType::create(['name' => 'Slider', 'description' => 'Slides to appear in a slider plugin', 'application_id' => $application->id, 'action' => 'partials.sections.slider', 'action_type' => 'view', 'package' => 'sodacms', 'identifier' => 'slider', 'status' => Status::LIVE, 'edit_action' => 'view', 'edit_action_type' => 'soda::blocks.index']);
 }