Skip to content

Commit

Permalink
Merge pull request #8 from KumbiaPHP/dev
Browse files Browse the repository at this point in the history
Merge dev branch in master
  • Loading branch information
henrystivens authored May 11, 2020
2 parents 81b283a + a2ffccf commit a995774
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

/vendor
/composer.lock
/public/index.php

# temp
/app/temp/cache/*
/app/temp/logs/*

# custom configs
phpunit.xml

# IDEs
.vscode/
.idea/
/nbproject

# Mac filesystem dust
.DS_Store

# Windows thumbnail cache files
Thumbs.db

# Linux trash folder which might appear on any partition or disk
.Trash-*
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,26 @@

Community backend to avoid repeating ourselves in new applications.

### Requirements

* PHP >= 7.2 <https://www.php.net/>
* Composer <https://getcomposer.org/download/>

### Install

1. Clone or download this repository
2. Open the console and enter the `KuAdmin/` folder
3. Run command `composer install` to get the dependencies

### Run

1. Open the console and enter the `KuAdmin/app/` folder
2. Run command `bin/phpserver`
3. Open http://0.0.0.0:8001 in your browser

### Support us

[Donate our collective](https://opencollective.com/kumbiaphp)

Chat with us
<https://slack.kumbiaphp.com>
Binary file added app/config/mysql/ku_admin.mwb
Binary file not shown.
122 changes: 122 additions & 0 deletions app/config/mysql/ku_admin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
-- MySQL Script generated by MySQL Workbench
-- Sun May 10 19:28:53 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema ku_admin
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `ku_admin` ;

-- -----------------------------------------------------
-- Schema ku_admin
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `ku_admin` DEFAULT CHARACTER SET utf8 ;
USE `ku_admin` ;

-- -----------------------------------------------------
-- Table `ku_admin`.`permissions`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ku_admin`.`permissions` (
`id` INT NOT NULL AUTO_INCREMENT,
`roles_id` INT NOT NULL,
`resources_id` INT NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_permissions__roles`
FOREIGN KEY (`roles_id`)
REFERENCES `ku_admin`.`roles` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_permissions__resources`
FOREIGN KEY (`resources_id`)
REFERENCES `ku_admin`.`resources` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

CREATE INDEX `fk_permissions_roles_idx` ON `ku_admin`.`permissions` (`roles_id` ASC);

CREATE INDEX `fk_permissions_resources_idx` ON `ku_admin`.`permissions` (`resources_id` ASC);


-- -----------------------------------------------------
-- Table `ku_admin`.`resources`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ku_admin`.`resources` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(127) NOT NULL,
`description` VARCHAR(255) NULL,
`url` VARCHAR(255) NOT NULL,
`module` VARCHAR(45) NULL,
`controller` VARCHAR(45) NOT NULL,
`action` VARCHAR(45) NOT NULL,
`status` INT NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;

CREATE UNIQUE INDEX `resources_name_UNIQUE` ON `ku_admin`.`resources` (`name` ASC);

CREATE UNIQUE INDEX `resources_url_UNIQUE` ON `ku_admin`.`resources` (`url` ASC);


-- -----------------------------------------------------
-- Table `ku_admin`.`roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ku_admin`.`roles` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NULL,
`status` INT NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ku_admin`.`users`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ku_admin`.`users` (
`id` INT NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) NOT NULL,
`username` VARCHAR(45) NULL,
`password` VARCHAR(255) NULL,
`first_name` VARCHAR(255) NULL,
`middle_name` VARCHAR(255) NULL,
`last_name` VARCHAR(255) NULL,
`status` INT NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;

CREATE UNIQUE INDEX `users_email_UNIQUE` ON `ku_admin`.`users` (`email` ASC);


-- -----------------------------------------------------
-- Table `ku_admin`.`users_roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ku_admin`.`users_roles` (
`id` INT NOT NULL AUTO_INCREMENT,
`users_id` INT NOT NULL,
`roles_id` INT NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_users_roles__users`
FOREIGN KEY (`users_id`)
REFERENCES `ku_admin`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_users_roles__roles`
FOREIGN KEY (`roles_id`)
REFERENCES `ku_admin`.`roles` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

CREATE INDEX `fk_users_roles_users_idx` ON `ku_admin`.`users_roles` (`users_id` ASC);

CREATE INDEX `fk_users_roles_roles_idx` ON `ku_admin`.`users_roles` (`roles_id` ASC);


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
8 changes: 8 additions & 0 deletions app/libs/lite_record.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

/**
* Parent class to use SQL with the advantages of ORM
*/
abstract class LiteRecord extends \Kumbia\ActiveRecord\LiteRecord
{
}
Empty file removed app/models/empty
Empty file.
4 changes: 4 additions & 0 deletions app/models/permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class Permissions extends LiteRecord
{
}
4 changes: 4 additions & 0 deletions app/models/resources.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class Resources extends LiteRecord
{
}
4 changes: 4 additions & 0 deletions app/models/roles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class Roles extends LiteRecord
{
}
4 changes: 4 additions & 0 deletions app/models/users.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class Users extends LiteRecord
{
}
4 changes: 4 additions & 0 deletions app/models/users_roles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class UsersRoles extends LiteRecord
{
}
Binary file added app/temp/sqlite/ku_admin.db
Binary file not shown.

0 comments on commit a995774

Please sign in to comment.