- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
# PHP annotations support for route 🚀 | |
composer require annotations | |
# Symfony maker bundle added for quick development 📦 | |
composer require symfony/maker-bundle --dev | |
# For database | |
composer require symfony/orm-pack | |
# Security 👮 |
### SET THESE OUTSIDE `server` BLOCK ### | |
# set cache path, key and expiration time | |
fastcgi_cache_path /tmp/cache levels=1:2 keys_zone=MYAPP:512m inactive=60m; | |
# handle nginx crash, timeout, error responses and serve cached data | |
fastcgi_cache_use_stale error timeout invalid_header http_500; | |
# ignore cache headers | |
fastcgi_ignore_headers Cache-Control Expires Set-Cookie; |
# install necessary softwares & update dependencies | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common curl git | |
sudo apt-get dist-upgrade | |
# install php 7.2 | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install php7.2 |
#! /usr/bin/env bash | |
# Variables | |
APPENV=local | |
DBHOST=localhost | |
DBNAME=dbname | |
DBUSER=dbuser | |
DBPASSWD=test123 | |
echo -e "\n--- Mkay, installing now... ---\n" |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/sumonselim/.oh-my-zsh | |
# Set name of the theme to load. | |
ZSH_THEME="powerlevel9k/powerlevel9k" | |
# powerlevel9k customizations | |
POWERLEVEL9K_MODE='awesome-patched' | |
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3 | |
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle" |
<?php | |
$array = []; | |
foreach ($_POST['name'] as $key => $value) { | |
$array[$key]['name'] = $value; | |
$array[$key]['email'] = $_POST['email'][$key]; | |
} | |
var_dump($array); |