Skip to content

Instantly share code, notes, and snippets.

View driesvints's full-sized avatar

Dries Vints driesvints

View GitHub Profile
@driesvints
driesvints / laravel-weekly-24-quick-tip.php
Created September 24, 2013 08:22
Laravel Weekly #24 - Quick Tip
<?php
// Redirect to a named 'home' route.
return Redirect::home();
// Refresh the current URI.
return Redirect::refresh();
<?php
use Illuminate\Contracts\Validation\Rule;
class ValidPaymentToken implements Rule;
{
private $gateway;
private $param1;
private $param2;
@component('mail::button', ['color' => 'green'])
Button text
@endcomponent
@driesvints
driesvints / config.yml
Last active September 5, 2018 09:29
Put this in a `.circleci` directory
experimental:
notify:
branches:
only:
- master
version: 2
jobs:
php7.1-5.5:
docker:
@driesvints
driesvints / laravel-weekly-23-quick-tip.php
Last active October 23, 2018 07:52
Laravel Weekly #23 - Quick Tip
<?php
# Create a list with numbers ranging from 10 to 20.
Form::selectRange('number', 10, 20);
# Create a list with years ranging from 1900 to 2000.
Form::selectYear('year', 1900, 2000);
# Creates a list with month names.
Form::selectMonth('month');
<?php
use Illuminate\Contracts\Validation\Rule;
class ValidPaymentToken implements Rule;
{
/**
* @var \CreditCardGateway
*/
private $gateway;
@driesvints
driesvints / laravel-weekly-25-quick-tip.php
Last active March 28, 2019 13:52
Laravel Weekly #25 Quick Tip
<?php
// Get an array of all files in a directory.
$files = File::files('path_to_dir');
// Get all of the files from the given directory (recursive).
$files = File::allFiles('path_to_dir');
// Get all of the directories within a given directory.
$files = File::directory('path_to_dir');
@driesvints
driesvints / SearchThreads.php
Created July 3, 2017 07:37
Multiple method query objects
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()
@driesvints
driesvints / SearchThreads.php
Last active February 13, 2020 11:13
Invokable query object
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()