/** * boot * observing model * */ public static function boot() { parent::boot(); Policy::observe(new PolicyObserver()); }
/** * Delete a Policy * * @return Response */ public function delete($org_id = null, $id = null) { // $policy = \App\ThunderID\OrganisationManagementV1\Models\Policy::id($id)->organisationid($org_id)->first(); if (!$policy) { return new JSend('error', (array) Input::all(), 'Policy tidak ditemukan.'); } $result = $policy->toArray(); if ($policy->delete()) { return new JSend('success', (array) $result); } return new JSend('error', (array) $result, $policy->getError()); }