For the scenario, imagine posts has a foreign key user_id referencing users.id
public function up()
{
Schema::create('posts', function(Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('body');For the scenario, imagine posts has a foreign key user_id referencing users.id
public function up()
{
Schema::create('posts', function(Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('body');| #!/bin/bash | |
| # | |
| # Use this script to perform backups of one or more MySQL databases. | |
| # | |
| # Databases that you wish to be backed up by this script. You can have any number of databases specified; encapsilate each database name in single quotes and separate each database name by a space. | |
| # | |
| # Example: | |
| # databases=( '__DATABASE_1__' '__DATABASE_2__' ) |
| <?php | |
| // Define a 32-byte (64 character) hexadecimal encryption key | |
| // Note: The same encryption key used to encrypt the data must be used to decrypt the data | |
| define('ENCRYPTION_KEY', 'd0a7e7997b6d5fcd55f4b5c32611b87cd923e88837b63bf2941ef819dc8ca282'); | |
| // Encrypt Function | |
| function mc_encrypt($encrypt, $key){ | |
| $encrypt = serialize($encrypt); | |
| $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM); | |
| $key = pack('H*', $key); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>iOS6 Safari Photo Capture Demo</title> | |
| <script type="text/javascript"> | |
| window.onload = function() { | |
| var input = document.getElementById("input"); | |
| input.addEventListener("change", handleFile); | |
| } |
| <?php | |
| /** | |
| * Dump helper. Functions to dump variables to the screen, in a nicley formatted manner. | |
| * @author Joost van Veen | |
| * @version 1.0 | |
| */ | |
| if (!function_exists('dump')) { | |
| function dump ($var, $label = 'Dump', $echo = TRUE) | |
| { | |
| // Store dump in variable |
| <?php | |
| //Get data from instagram api | |
| $hashtag = 'max'; | |
| //Query need client_id or access_token | |
| $query = array( | |
| 'client_id' => '', | |
| 'count' => 3 | |
| ); | |
| $url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?'.http_build_query($query); |
| $(function () { | |
| "use strict"; | |
| // for better performance - to avoid searching in DOM | |
| var content = $('#content'); | |
| var input = $('#input'); | |
| var status = $('#status'); | |
| // my color assigned by the server | |
| var myColor = false; |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| <?php | |
| // requires php5 | |
| define('UPLOAD_DIR', 'images/'); | |
| $img = $_POST['img']; | |
| $img = str_replace('data:image/png;base64,', '', $img); | |
| $img = str_replace(' ', '+', $img); | |
| $data = base64_decode($img); | |
| $file = UPLOAD_DIR . uniqid() . '.png'; | |
| $success = file_put_contents($file, $data); |