This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class TransactionHelper { | |
protected $closures = []; | |
public function add(Closure $closure) | |
{ | |
$this->closures[] = $closure; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Person = DS.Model.extend({ | |
id: DS.attr('number'), | |
name: DS.attr('string'), | |
city: DS.attr('string'), | |
company: DS.belongsTo('company') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.App = Ember.Application.create(); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend(); | |
App.PersonController = Ember.ObjectController.extend({ | |
isEditing: false, | |
actions: { | |
edit: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW companiesExtended AS | |
select *, (select group_concat(id separator ',') from people as peopleTable where companyTable.id = peopleTable.`company_id`) as people_ids from companies as companyTable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
class CreateCompaniesTable extends Migration { | |
public function up() | |
{ | |
Schema::create('companies', function($table) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Person extends BaseModel | |
{ | |
protected $table = 'people'; | |
protected $fillable = [ | |
'firstName', | |
'lastName', | |
'email', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"posts": [{ | |
"id": "1", | |
"title": "A blog title", | |
"links": { | |
"author": "http://example.com/people/1", | |
"comments": "http://example.com/comments/5,12,17,20" | |
} | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Why are collections namespaced and single entity responses not? For example: | |
[ | |
{ | |
"name": "Hulk Hogan", | |
"id": "100002" | |
}, | |
{ | |
"name": "Mick Foley", | |
"id": "100003" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.PeopleNewController = Ember.ObjectController.extend({ | |
companySelection: null, | |
actions: { | |
doneEditing: function () { | |
var person = this.get('model'); | |
person.save(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"companies": [ | |
{ | |
"id": "1", | |
"created_at": "2013-12-09 00:57:49", | |
"updated_at": "2013-12-09 00:57:49", | |
"name": "Acme Corp", | |
"links": { | |
"tasks": "/companies/1/tasks", | |
"people": "/companies/1/people" |