View webpack.mix.js
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(),
View forms.css
.form-label {
@apply .mb-2 .block .text-sm .text-dark;
}
.form-input,
.form-textarea,
.form-select {
@apply .p-2 .leading-normal .block .w-full .border .text-dark .bg-light .text-sm .font-sans .rounded .text-left .appearance-none;
&:focus {
View tailwind-docs.sh
# Clone the Tailwind repo locally
git clone git@github.com:tailwindcss/tailwindcss.git tailwind
# Go to Tailwind folder
cd tailwind
# Install Tailwind JS dependencies
npm install
# Go to docs folder
View in-memory-sqlite-database.php
<?php
// Create in-memory SQLite database
$sqlite = new PDO('sqlite::memory:');
// Generate schema (for whatever tables you want)
$sqlite->prepare('CREATE TABLE users(id, family_id, first_name, last_name, email)')->execute();
$sqlite->prepare('CREATE TABLE families(id, name, phone, address)')->execute();
// Insert pre-defined data
View AppServiceProvider.php
<?php
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()
View validation_macros.php
<?php
Request::macro('validate', function ($rules, $messages = [], $customAttributes = []) {
$this->lastValidated = array_keys($rules);
(new class() {
use ValidatesRequests;
})->validate($this, $rules, $messages, $customAttributes);
});
View RememberQueryStrings.php
<?php
namespace App\Http\Middleware;
use Closure;
class RememberQueryStrings
{
public function handle($request, Closure $next)
{
View User.php
<?php
namespace App;
use App\Scopes\WithSelects;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
View drop_all_tables_in_postgresql.php
<?php
// Select all tables from the database
$tables = DB::select("SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public'");
// Get array of just the table names
$tables = array_column($tables, 'tablename');
// Loop through and drop each table
// The "cascade" option is important otherwise foreign keys constraints will fail
View TrimMiddleware.php
<?php
namespace ChurchSocial\Middleware;
use Closure;
class TrimMiddleware
{
public function handle($request, Closure $next)
{