Skip to content

Instantly share code, notes, and snippets.

@Dragory
Last active August 29, 2015 13:56
Show Gist options
  • Save Dragory/8920458 to your computer and use it in GitHub Desktop.
Save Dragory/8920458 to your computer and use it in GitHub Desktop.
<?php
class CustomerAffiliationController extends BaseController
{
public function index($customer_id)
{
$affiliations = Affiliation::with("AffiliationCategory", "Organism")->where("customer_id","=", $customer_id)->get();
return $affiliations;
}
public function store($customer_id)
{
$input = Input::json();
$customer = Customer::find($customer_id);
$customer->affiliations()->sync($input);
$customer->save();
return '';//Response::eloquent($customer);
}
}
{
"1": {"affiliation_category_id":7,"started_at_year":2015},
"2": {"affiliation_category_id":8,"started_at_year":2016}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment