예제 #1
0
 public function destroy($id)
 {
     $type = Type::find($id);
     $type->attributes()->detach();
     // Need to reset all subjects that use this type via foreign key
     // Had better make a warning message to explain that this will
     // happen and have the user confirm
     $subjects = Subject::where('type_id', '=', $id)->update(array('type_id' => 1));
     $type->delete();
     Session::flash('message', 'Type deleted.');
     return Redirect::back();
 }
 public function edit($id)
 {
     $subject = Subject::find($id);
     $types = Type::lists('name', 'id');
     return \View::make('admin::subject.edit')->with(array('subject' => $subject, 'types' => $types));
 }