dq62957 2017-05-23 04:18
浏览 41

在laravel 5.4中将用户数据发送给另一个用户

I try to send user data stored in database to another users after first user click on button.

I asked Add apply button to laravel 5.4 this question before, and I'm trying to do what was suggested to me, currently i have this code:

@if (Auth::guest())

@else
    <div class="text-center">
        <a class="btn btn-info btn-round" href="#" id="{{ Auth::user()->id }}">
            <i class="now-ui-icons ui-1_send"></i> APPLY NOW
        </a>
    </div>
@endif

first of all I know my code is not complete and I don't know how to finish it! Second I have no idea how to pass data to second user.

PS: I need code not just suggestions I already got suggestions and I'm stuck in that.

Thanks.

  • 写回答

1条回答 默认 最新

  • duanhui1869 2017-05-23 10:20
    关注
    1. create function on your controller to receive user id and get all user information
       public function apply($id){
              $data["users"] = User::where('id', $id)->get()->first();
              return view("dashboard", $data)
        }
    
    1. create route with post or get method, in this section i use get method,

    Route::get('/apply/{id}', 'YourController@apply');

    Your a href should like this

      <a class="btn btn-info btn-round" href="apply/{{ Auth::user()->id }}">
         <i class="now-ui-icons ui-1_send"></i> APPLY NOW
      </a>
    
    1. on your dashboard, declare user information using this script

    $user->name
    $user->email`

    etc,

    Hope this can help your problem, any question please comment

    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备