/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $golongan = Golongan::find($id); if ($golongan->delete()) { return Response::json(array('success' => TRUE)); } }
/** * The attributes excluded from the model's JSON form. * * @var array */ public function getNamaGolonganAttribute() { $name = $this->attributes['id_golongan']; $data = Golongan::find($name); if ($data) { return $data->golongan; } return '-'; }