Skip to content

Instantly share code, notes, and snippets.

@duikb00t
duikb00t / routes
Created March 27, 2014 08:57
routes
<?php
/**
* Routes
*
*
*/
Route::group(["before" => "guest"], function()
{
Route::group(["before" => "guest"], function()
@duikb00t
duikb00t / NewProject.php
Created March 28, 2014 08:58
sadfsafasf
<?php
class NewProject extends \Eloquent {
protected $fillable = [];
public static $campaignTypes = array(
'' => 'Choose One',
1 => 'Active',
2 => 'inactive',
3 => 'Deleted',
$user = Auth::user();
$role = $user->role;
// This returns me all the users in the table...
$users = User::all();
// But I would like to search on a field in that users table:
$users = User::all()->where('first_name','like','%'.$query.'%')->toArray();
class SearchController extends \BaseController {
public function appendValue($data, $type, $element)
{
// operate on the item passed by reference, adding the element and type
foreach ($data as $key => & $item) {
$item[$element] = $type;
}
return $data;
<div class="control-group">
<p class="pull-left">Authorised Viewers</p>
@foreach(array_chunk($users->all(), 3) as $row)
<div class="controls span2">
@foreach ($users as $user)
<label class="checkbox">
<input type="checkbox" value="option{{ $user->id }}" id="option{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}
</label>
$users = User::select(array('id','role','first_name','last_name'))
->where('role','like','manager')
->get(array('first_name','last_name'));
$telemarketeers = User::select(array('id','role','first_name','last_name'))
->where('role','like','telemarketeer')
->get(array('first_name','last_name'));
@duikb00t
duikb00t / autoloading
Created April 17, 2014 12:15
autoloading
<?php
require_once __DIR__.'/../vendor/autoload.php';
$app = require __DIR__.'/../src/app.php';
require __DIR__.'/../config/prod.php';
require __DIR__.'/../src/controllers.php';
@duikb00t
duikb00t / Language Switcher blade laravel
Last active September 2, 2015 11:51
Language Switcher blade laravel - add active class to the current language so you can style it with CSS.
<ul class="language_bar_chooser pull-right">
@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
<li>
@if ( $localeCode == LaravelLocalization::getCurrentLocale() )
<a class="active"rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">{{{ $properties['native'] }}}</a>
@else
<a rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">{{{ $properties['native'] }}}</a>
@endif
</li>
@endforeach