Beispiel #1
0
 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  * 删除
  */
 public function destroy($id)
 {
     //dd($id);
     $discuss = Discuss::findOrFail($id);
     $discuss->delete();
     return redirect()->back();
 }
Beispiel #2
0
 protected function fieldsFromModel($id, array $fields)
 {
     $discuss = Discuss::findOrFail($id);
     $fieldNames = array_keys(array_except($fields, ['tags']));
     $fields = ['id' => $id];
     foreach ($fieldNames as $field) {
         $fields[$field] = $discuss->{$field};
     }
     //$fields['tags'] = $post->tags()->lists('tag')->all();
     return $fields;
 }
Beispiel #3
0
 public function getForum()
 {
     $model = new Discuss();
     $arr['forum'] = $model->getForum($_GET['id']);
     $user = new User();
     $arr['forum']['user_info'] = $user->getUser_one($arr['forum']['author_id']);
     $arr['reply'] = $model->getReply($_GET['id']);
     $i = 0;
     foreach ($arr['reply'] as $key => $val) {
         $arr['reply'][$key]['user_info'] = $model->getUser($arr['reply'][$key]['u_id']);
         $arr['reply'][$key]['_id'] = substr($arr['reply'][$key]['_id'] . 'aaa', 0, -3);
         //print_r($arr['reply'][$key]);die;
         foreach ($arr['reply'] as $k => $v) {
             if ($arr['reply'][$key]['_id'] == $arr['reply'][$k]['f_id']) {
                 $arr['reply'][$key]['son'][$i] = $arr['reply'][$k];
                 $i++;
             }
         }
     }
     $arr['user'] = session::get('u_id');
     return view('discuss/forum', $arr);
 }
Beispiel #4
0
 public function store(DiscussCreateRequest $request)
 {
     Discuss::create($request->discussFillDate());
     return redirect()->back();
 }