- Setup a fresh Laravel 5.8 application.
- Use Tailwind CSS as the CSS framework.
- CDN version is fine.
- Bonus points if installed via NPM.
- Create a new contact page at
/contact
. - Create a contact form on the page.
- The form should be built as a Vue component.
- The form should submit via ajax.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* '\.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|ttf|ttc|otf|eot|woff)$' | |
{ | |
expires 1y; | |
add_header Cache-Control "public"; | |
add_header "Cache-Control" "no-transform"; | |
location ~* '(.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$' | |
{ | |
try_files $uri $1.$2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use PHPUnit\Framework\Assert; | |
use Illuminate\Database\Eloquent\Collection; | |
use Illuminate\Foundation\Testing\TestResponse; | |
TestResponse::macro('data', function ($key) { | |
return $this->original->getData()[$key]; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use getID3; | |
$id3 = (new getID3())->analyze(Request::file('file')->getPathname()); | |
$duration = isset($id3['playtime_string']) ? str_pad($id3['playtime_string'], 8, '00:00:00', STR_PAD_LEFT) : null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<inertia-head> | |
<title v-if="title">{{ title }} - My App</title> | |
<title v-else>My App</title> | |
<slot /> | |
</inertia-head> | |
</template> | |
<script> | |
export default { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cssImport = require('postcss-import') | |
let cssNext = require('postcss-cssnext') | |
let glob = require('glob-all') | |
let mix = require('laravel-mix') | |
let purgeCss = require('purgecss-webpack-plugin') | |
let tailwind = require('tailwindcss') | |
mix.js('resources/assets/js/app.js', 'public/js') | |
.postCss('resources/assets/css/app.css', 'public/css/app.css', [ | |
cssImport(), |
The PHP Code Sniffer helps identity violations again coding standards (ie. PSR) as well as syntax errors in your code. The following tutorial explains how to setup the PHP Code Sniffer in Sublime Text (on OSX). This has been tested in Sublime Text 2 and Sublime Text 3.
You can use Pear, but that's just confusing, and requires you to have Pear installed. Move on to the next option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Support\Facades\Session; | |
use Illuminate\Database\Eloquent\Model as Eloquent; | |
abstract class Model extends Eloquent | |
{ | |
protected $guarded = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Source: http://www.jonasjohn.de/snippets/php/headers.htm | |
// Use this header instruction to fix 404 headers | |
// produced by url rewriting... | |
header('HTTP/1.1 200 OK'); | |
// Page was not found: | |
header('HTTP/1.1 404 Not Found'); |
// Option 1: Manually
this.$inertia.post(`/toggle-thing/${this.user.id}`, {}, { preserveScroll: true })
<!-- Option 2: Inertia Link -->
<inertia-link :href="`/toggle-thing/${user.id}`" preserve-scroll>Toggle</inertia-link>