InfoController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Http\Controllers\Admin\Interaction;
  3. use App\Models\CommentInfoModel;
  4. use App\Models\DreamInfoModel;
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Admin\Controller;
  7. class InfoController extends Controller
  8. {
  9. public function view(Request $request)
  10. {
  11. $dream = DreamInfoModel::find($request->id);
  12. $list = $dream->interactions;
  13. foreach ($list as $item){
  14. $item->comms = $item->comments;
  15. }
  16. return view('admin.dream.interaction.view',compact('list'));
  17. }
  18. public function update(Request $request,$id)
  19. {
  20. $data = (array) request('data');
  21. $ok =CommentInfoModel::where('id',$id)->update($data);
  22. if($ok) {
  23. $url[] = array('url'=>U( 'Dream/Info/index'),'title'=>'返回列表');
  24. return $this->showMessage('操作成功',urldecode(request('_referer')));
  25. }else{
  26. $url[] = array('url'=>U( 'Dream/Info/index'),'title'=>'返回列表');
  27. return $this->showWarning('操作失败',$url);
  28. }
  29. // dd($data);
  30. }
  31. }