Place in the routes/console.php file.
The install macro will migrate / seed the database and link the storage directory.
Be sure to enter your database credentials in the .env file first.
php artisan install
| { | |
| "root": true, | |
| "parser": "babel-eslint", | |
| "extends": [ | |
| "eslint:recommended", | |
| "plugin:react/recommended", | |
| "plugin:import/errors", | |
| "plugin:import/warnings", | |
| "plugin:jsx-a11y/recommended", | |
| "plugin:react-hooks/recommended", |
| import React, { useState, useEffect, useCallback } from 'react'; | |
| import { useFormikContext } from 'formik'; | |
| import _ from 'lodash'; | |
| const AutoSave = ({ debounceMs = 1000 }) => { | |
| const formik = useFormikContext(); | |
| const [isSaved, setIsSaved] = useState(null); | |
| const debouncedSubmit = useCallback( | |
| _.debounce(() => { | |
| return formik.submitForm().then(() => setIsSaved(true)); |
| // Can't use curried functions for some reason? | |
| // Never fear, partial application via the bind() method is here! | |
| const getFromAPI = (baseURL, endpoint, callback) => | |
| fetch(`${baseURL}${endpoint}`) | |
| .then(res => res.json()) | |
| .then(data => callback(data)) | |
| // Partially apply the baseURL | |
| const getFromGithub = getFromAPI.bind(null, 'https://api.github.com') |
| // @see https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens | |
| // ======================= | |
| // get the packages we need ============ | |
| // ======================= | |
| var express = require('express'); | |
| var app = express(); | |
| var bodyParser = require('body-parser'); | |
| var morgan = require('morgan'); | |
| var mongoose = require('mongoose'); |
| const bcrypt = require("bcrypt"); | |
| // use this library in case your version of node doesn't support Promise | |
| // const Promise = require("promise"); | |
| let password = "hello"; | |
| let stored_hash = ""; | |
| // first generate a random salt | |
| function genSalt(password) { | |
| return new Promise((resolve, reject) => { |
| public function add() | |
| { | |
| $user = $this->Users->newEntity(); | |
| if ($this->request->is('post')) { | |
| $user = $this->Users->patchEntity($user, $this->request->data); | |
| if ($this->Users->save($user)) { | |
| $this->Flash->success(__('The user has been saved.')); | |
| return $this->redirect(['action' => 'index']); | |
| } else { | |
| $this->Flash->error(__('The user could not be saved. Please, try again.')); |
| // ES6 tl;dr; for beginners | |
| // 1. variables | |
| // `const` & `let` are scoped at the block level | |
| if(true) { | |
| let foo = "bar" | |
| } | |
| foo // ReferenceError | |
If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).
The following is a possible scheme to use: