Skip to content

Instantly share code, notes, and snippets.

@Sean-Spallen
Sean-Spallen / script.js
Created April 21, 2020 19:32
Laravel Modals
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus()
})
@Sean-Spallen
Sean-Spallen / web.php
Created April 20, 2020 19:00
Laravel - Middleware
Route::get('locked', function () {
// Protected content
})->middleware('auth');
@Sean-Spallen
Sean-Spallen / CONTROLLER_NAME
Created January 20, 2020 22:35
Laravel Controller Template
use App\Item;
class ItemController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
@Sean-Spallen
Sean-Spallen / Standard
Created November 19, 2019 23:00
Wordpress Rest API
<?php
/**
* Template Name: Custom API Endpoint
# Updating views and storage
https://example.com/custom-api/?views=9435345&storage=2334242&site_id=2394&token=token_key
*/
// Capture query string as variables
if (stage == STAGE_ID) {
// UPDATE STYLE
updateBackground(COLOUR);
updateBorder(COLOUR);
CLEAR CONTENT & NARRATIVE
resetContent();
// RANDOM EVENT - Injured?
@Sean-Spallen
Sean-Spallen / assessPlayerDamage
Created November 11, 2019 18:22
Functions relating to player damage systemw
function assessPlayerDamage() {
};
@Sean-Spallen
Sean-Spallen / Laravel - Dump & Die
Created May 13, 2019 14:58
Laravel - Dump & Die
{{ dd($variable) }}
@Sean-Spallen
Sean-Spallen / Laravel - Routes Template
Created May 13, 2019 13:19
Laravel - Routes Template
Route::resource('shares', 'ShareController');
@Sean-Spallen
Sean-Spallen / laravel - Controller Template
Last active May 13, 2019 14:52
laravel - Controller Template
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ShareController extends Controller
{
/**
* Display a listing of the resource.
@Sean-Spallen
Sean-Spallen / Laravel - AJAX Store Function
Created May 10, 2019 08:45
Laravel - AJAX Store Function
use App\Grocery;
public function store(Request $request)
{
$grocery = new Grocery();
$grocery->name = $request->name;
$grocery->type = $request->type;
$grocery->price = $request->price;
$grocery->save();