- 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
# 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 |
<?xml version="1.0" encoding="UTF-8"?> | |
<ruleset name="Laravel and similar phpmd ruleset" | |
xmlns="http://pmd.sf.net/ruleset/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" | |
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> | |
<description> | |
Inspired by https://github.com/phpmd/phpmd/issues/137 | |
using http://phpmd.org/documentation/creating-a-ruleset.html | |
</description> |
name: Tests (PHP) | |
on: [push] | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/SumonMSelim/.oh-my-zsh | |
# Set name of the theme to load. | |
ZSH_THEME="powerlevel9k/powerlevel9k" | |
POWERLEVEL9K_MODE="awesome-fontconfig" | |
# User configuration | |
export TERM="xterm-256color" | |
export SHELL="/bin/zsh" |
FROM node:lts | |
ENV APP_NAME "app" | |
ENV HOME /home | |
ENV APP_DIR $HOME/$APP_NAME | |
RUN mkdir $APP_DIR | |
WORKDIR $APP_DIR | |
EXPOSE 3000 |
version: "3.7" | |
services: | |
node: | |
build: | |
context: ./.docker/node | |
dockerfile: ./Dockerfile | |
command: bash -c "npm install && npm start" | |
container_name: app | |
ports: | |
- 3001:3001 |
<?php | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* @ORM\Embeddable | |
*/ |
<?php | |
namespace App\Entity\Embeddable; | |
use App\Model\Intl\MoneyInterface; | |
use Brick\Math\BigNumber; | |
use Brick\Math\Exception\NumberFormatException; | |
use Brick\Math\RoundingMode; | |
use Brick\Money\Context\CustomContext; | |
use Doctrine\ORM\Mapping as ORM; |
<?php | |
namespace App\Jobs; | |
use App\Models\Domain; | |
use App\Models\Event; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; | |
use Illuminate\Queue\InteractsWithQueue; |