Example #1
0
 public static function findFamily($user)
 {
     $families = \Family::all(["user_id = ?" => $user->id], ["member_id", "relation"]);
     $fs = array();
     foreach ($families as $f) {
         $u = \User::first(["id = ?" => $f->member_id], ["name"]);
         $fs[(int) $f->member_id] = ArrayMethods::toObject(["name" => $u->name, "user_id" => $f->member_id, "relation" => $f->relation]);
     }
     return $fs;
 }
Example #2
0
 /**
  * @before _secure
  */
 public function family($action = NULL, $id = NULL)
 {
     $this->seo(array("title" => "Family Added", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if ($action == "delete") {
         $family = Family::first(array("id = ?" => $id));
         if ($family) {
             $family->delete();
         }
     }
     $members = Family::all(array("user_id = ?" => $this->user->id), array("member_id", "relation", "id"));
     $view->set("members", $members);
 }
 public function admin_index()
 {
     $family_laws = Family::all();
     return View::make('families.admin_index', compact('family_laws'));
 }