当试图返回并且它不起作用时。 Laravel告诉我那页做
@extends('layouts.app')
@section('koteret')
כל המשתמשים
@endsection
@section('content')
@if(count($allUsers)>0)
@foreach($allUsers as $user)
{{$user->username}}
<?php
$if_null = App\Follower::where('follower_id','=', $user->id)->first();
if (is_null($if_null)){
?>
<a href="{{route('following', $user->id)}}" class="btn btn-rounded btn-danger btn-sm">עקוב</a>
<?php }
else {?>
<a href="profile.html" class="btn btn-rounded btn-danger btn-sm">אתה עוקב</a>
<?php }?>
@endforeach
@else
לא נמצא דבר
@endif
@endsection
&#13;
还有功能
public function following($id) {
$follow = New Follower;
$follow->user_id = Auth::user()->id;
$follow->follower_id = $id;
$follow->save();
return back();
}
路线
Route::get('/following/{$id}','FollowingController@following')->name('following');
答案 0 :(得分:0)
尝试以下方法之一:
return back();
return redirect()->back();
return redirect()->previous();
答案 1 :(得分:0)
好的,我更改了该功能的名称,它似乎现在正常工作,我不知道为什么!:)
感谢您的帮助