Skip to content

Instantly share code, notes, and snippets.

@jdecode
Last active September 30, 2020 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdecode/b2754547a461f289493df38a51776524 to your computer and use it in GitHub Desktop.
Save jdecode/b2754547a461f289493df38a51776524 to your computer and use it in GitHub Desktop.
Noter using Cakephp Mysql and Docker

Setup of Noter in CakePHP, MySQL and Docker (and other tools) - notes, commands, snippets go here.

Direct branch-URL - https://github.com/konnector-dev/noter/tree/cakephp-mysql

Repo URL - https://github.com/konnector-dev/noter

Branch - cakephp-mysql

Missed commands in the first version:

  1. git clone git@github.com:konnector-dev/noter.git
  2. cd noter
  3. git checkout cakephp-mysql
  4. docker-compose run noter composer install -n --prefer-dist
  5. docker-compose run noter bin/cake migrations migrate
  6. docker-compose run noter bin/cake migrations seed
  7. docker-compose up --build
@jdecode
Copy link
Author

jdecode commented Aug 31, 2020

Technically, no PHP code written so far.

@jdecode
Copy link
Author

jdecode commented Aug 31, 2020

The bin/cake bake all users generates scaffolding code for Model, View and Controller.

Now /users URL (in this case http://183.83.1.1/users) will take you to a "listing" page created by "bake" command and it will look like the following screenshot (as of CakePHP 4.1.3 Strawberry):

Screenshot from 2020-08-31 17-58-25

@jdecode
Copy link
Author

jdecode commented Aug 31, 2020

Adding screenshots for CRUD pages

@jdecode
Copy link
Author

jdecode commented Aug 31, 2020

3eb26330-ae34-43ae-a14d-b9ca5252139b

Key things to notice:

  • UUID is "not-so-famous" data type, so the input field for that is "non-stylized"
  • Email field is having "type=email" (HTML source code not in screenshot)
  • Password field is having "type=password"
  • The TINYINT(1) columns are handled as "boolean" by default, and hence the "checkbox", depicting a TRUE/FALSE or 1/0 state
  • Date/time column (email_verified_at) has a date/time picker and also supports keyboard-navigation as well (pretty awesome)
    Screenshot from 2020-08-31 18-54-35

@jdecode
Copy link
Author

jdecode commented Sep 1, 2020

Adding a couple of users (plain text entries, no file uploads or any other kind of logic, yet), makes the user listing page like this:

Screenshot from 2020-09-01 12-59-09

@jdecode
Copy link
Author

jdecode commented Sep 1, 2020

"View" user (details page)

a03665c4-0807-4328-b89f-1316e4dfa082

@jdecode
Copy link
Author

jdecode commented Sep 1, 2020

Deleting a user prompts the javascript "confirm" popup box

Screenshot from 2020-09-01 14-14-03

@jdecode
Copy link
Author

jdecode commented Sep 1, 2020

So far - not a single hand-written code in PHP!

@jdecode
Copy link
Author

jdecode commented Sep 5, 2020

admins

  • id
  • uuid
  • login
  • password
  • name
  • active
  • remember_me_token
  • last_logged_in
  • created
  • modified

bin/cake bake migration CreateAdmins uuid:uuid[64]:index:UUID_INDEX login:string?:index:LOGIN_INDEX password:string? name:string? active:boolean? remember_me_token:string?:index:REMEMBER_ME_TOKEN_INDEX last_logged_in:datetime? created:datetime? modified:datetime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment