settings_model.php 458 B

1234567891011121314151617181920212223
  1. <?php
  2. class Settings_model extends Model{
  3. function lists(){
  4. return DB::get('settings')->result();
  5. }
  6. function edit($id){
  7. return DB::where('id',$id)->get('settings')->row();
  8. }
  9. function update($post){
  10. if ($post['value1']) {$d = $post['value1'];}else{$d = $post['value'];}
  11. DB::where('id',$post['id'])->update('settings',[
  12. 'title' => $post['title'],
  13. 'value' => $d
  14. ]);
  15. if (DB::affectedRows()) {
  16. redirect('admin/setting');
  17. }
  18. }
  19. }