Skip to content

Instantly share code, notes, and snippets.

<ul class="nav navbar-nav">
@foreach($items as $menu_item)
<li class="nav-item {{ url($menu_item->link()) == url()->current() ? 'active' : '' }}">
<a href="{{ url($menu_item->url) }}">
{{ $menu_item->title }}
</a>
</li>
@endforeach
</ul>
@ahuggins
ahuggins / web.php
Created February 26, 2017 03:09
Basic Routes
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
@ahuggins
ahuggins / Post.php
Created February 26, 2017 03:08
Post
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
public static function findBySlug($slug)
{
@ahuggins
ahuggins / Image.php
Created February 26, 2017 03:08
Image Class
<?php
namespace App;
class Image
{
protected $path;
public function __construct($path)
{
@ahuggins
ahuggins / AppServiceProvider.php
Created February 26, 2017 03:07
Voyager + Laravel 5.4
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
<?php
// Before
public function getIDsForClient()
{
$sql = "SELECT DISTINCT FilingID FROM Snapshot1094C WHERE ClientID = ?";
$params = [$this->clientID];
$stmt = sqlsrv_query($this->mssqli, $sql, $params);
$ids = [];
<?php
namespace Something {
const example = 'test';
}
namespace Another {
const example = 'anothervalue';
}
// look in .env file for definitions
define("HOST", env('DB_HOST')); // The host you want to connect to.
define("USER", env('DB_USER')); // The database username.
define("PASSWORD", env('DB_PASSWORD')); // The database password.
define("DATABASE", env('DB_DATABASE')); // The database name.
define("SECURE", env('DB_SECURE')); // The database name.
define('FTPHOST', env('SFTP_HOST'));
define('FTPPORT', env('SFTP_PORT'));
define('FTPUSER', env('SFTP_USER'));
@ahuggins
ahuggins / gist:5784bca19c25bbc7430aedbb5785b962
Last active November 28, 2016 19:09
die and dump rewrite
<?php
function dump()
{
array_map('pre', func_get_args());
}
function pre($to_dump)
{
echo "<pre>";
@ahuggins
ahuggins / php
Created September 3, 2016 19:07
<?php
public function get($topic, $specific = null, $param = null)
{
if (isset($this->config[$topic])) {
$value = $this->config[$topic];
}
if (! is_null($specific) && isset($value[$specific])) {
$value = $value[$specific];