Skip to content

Instantly share code, notes, and snippets.

View andrewhl's full-sized avatar

Andrew Hlavats andrewhl

View GitHub Profile
class FoodItemTemplatesController extends \BaseController {
...
public function index()
{
$food_item_templates = $this->foodItemTemplate->all();
return Response::json($food_item_templates);
}
...
export APP_ENV=production
...
[Illuminate\Database\QueryException]
SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop table food_it
em_templates because other objects depend on it
DETAIL: constraint food_items_food_item_template_id_foreign on table food_items de
pends on table food_item_templates
HINT: Use DROP ... CASCADE to drop the dependent objects too. (SQL: drop table "fo
od_item_templates")
@andrewhl
andrewhl / _bootstrap.php
Created June 22, 2014 14:08
Cannot use Auth::loginUsingId(1) in Codeception acceptance/_bootstrap.php file
<?php
Auth::loginUsingId(1);
<?php
use \AcceptanceTester;
use MyApp\TestHelpers\NavBarHelper;
use MyApp\TestHelpers\SignUpHelper;
class SignUpCest {
/**
* @var SignUpHelper
*/
<?php
class SignUpHelper {
/**
* @var AcceptanceTester
*/
private $tester;
function __construct(AcceptanceTester $tester)
{
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('see the landing page');
$I->amOnPage('/');
$I->see('Welcome');
/**
* Display the specified resource.
* GET /food_items/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
if ($food_item = $this->foodItem->find($id))
@andrewhl
andrewhl / site config
Created June 4, 2014 12:58
I'm running Laravel on an AWS EC2 instance, and I'm trying to use Nginx. I get a 403 Forbidden HTTP response when I try to visit the public IP address.
server {
listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;
root /home/ubuntu/public_html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name 54.23.4.31;
<?php
class ExampleTest extends TestCase {
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()