- 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
select | |
first_name, | |
last_name | |
from | |
users | |
left join | |
companies on companies.id = users.company_id | |
where ( | |
companies.name like 'TERM%' or | |
first_name like 'TERM%' or |
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
SELECT name | |
FROM devices | |
WHERE name IN ( | |
'Apple iPhone 11', | |
'Apple iPhone 3G', | |
'Apple iPhone XR' | |
) | |
ORDER By name+0<>0 DESC, name+0, name; |
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 | |
function trim_leading_whitespace($code) | |
{ | |
$lines = collect(explode("\n", $code)); | |
$min = collect(explode("\n", $code))->filter(function ($line) { | |
return trim($line); | |
})->min(function ($line) { | |
return strlen($line) - strlen(ltrim($line)); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Nulls Last</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"> | |
</head> | |
<body class="antialiased leading-none"> | |
<div class="flex w-full p-24 bg-gray-300"> |
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> | |
<div> | |
<label v-if="label" class="form-label" :for="`date-input-${_uid}`">{{ label }}:</label> | |
<input v-bind="$attrs" class="form-input" :id="`date-input-${_uid}`" :class="{ error: error }" type="text" ref="input" :value="value" @change="change" @keyup="change"> | |
<div v-if="error" class="form-error">{{ error }}</div> | |
</div> | |
</template> | |
<script> | |
import pikaday from 'pikaday' |
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 Illuminate\Database\Query\Builder; | |
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) { | |
$column = $this->getGrammar()->wrap($column); | |
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc'; | |
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST'; | |
return $this->orderByRaw("$column $direction $nulls", $bindings); | |
}); |
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 | |
$totals = DB::table('subscribers') | |
->addSelect(DB::raw('count(*) as all')) | |
->addSelect(DB::raw("sum(case when status = 'confirmed' then 1 else 0 end) as confirmed")) | |
->addSelect(DB::raw("sum(case when status = 'unconfirmed' then 1 else 0 end) as unconfirmed")) | |
->addSelect(DB::raw("sum(case when status = 'cancelled' then 1 else 0 end) as cancelled")) | |
->addSelect(DB::raw("sum(case when status = 'bounced' then 1 else 0 end) as bounced")) | |
->addSelect(DB::raw("sum(case when status = 'inactive' then 1 else 0 end) as inactive")) | |
->get(); |
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
<script> | |
import Inertia, { shouldIntercept } from 'inertia' | |
export let href, | |
method = 'get', | |
replace = false, | |
preserveScroll = false | |
function visit(event) { | |
if (shouldIntercept(event)) { |
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]; | |
}); |