Skip to content

Instantly share code, notes, and snippets.

View MrAtiebatie's full-sized avatar

Sjors van Dongen MrAtiebatie

View GitHub Profile
@MrAtiebatie
MrAtiebatie / nested_restful_controllers.php
Last active August 29, 2015 14:15
Laravel Nested RESTful Controllers
<?php
/**
* This is an example code for how to use nested RESTful controllers
* in Laravel 4 & 5. Yes, in this case you could you use a resource
* controller but sometimes you don't have the same method names
* as a resource controller. The method names in this example weren't
* my case so it's just some example code.
*
* You can also use static function calls instead of OOP way.
@MrAtiebatie
MrAtiebatie / BladeServiceProvider.php
Created March 8, 2018 15:04
Custom Blade directive
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class BladeServiceProvider extends ServiceProvider
{
/**
@MrAtiebatie
MrAtiebatie / api.php
Last active May 2, 2018 09:37
routes/api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
<?php
namespace App\Http\Controllers\Api;
use Pusher\Pusher;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class BroadcastAuthController extends Controller
{
<form action="{{ route('broadcast') }}" method="post">
{{ csrf_field() }}
<input type="text" name="message">
<button class="btn btn-default">Submit</button>
</form>
<?php
use App\Events\SendMessage;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
@MrAtiebatie
MrAtiebatie / Podfile
Last active May 14, 2018 11:25
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Pusher' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Pusher
pod 'Alamofire'
pod 'SwiftyJSON'
alert('Dit is code injection!');
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
/**
* The table associated with the model.