Пожалуйста, я пытаюсь получить как данные о событиях, так и данные об учениках на панели инструментов, но они, похоже, конфликтуют друг с другом. Записи учеников также показывают, где должны отображаться мои записи о событиях. Вот как это выглядит:
Маршруты
Route::post('/dashboard/submit', 'EventController@submit');
Route::get('/dashboard', 'EventController@getevent');
Route::post('/dashboard/student/pay', 'PaymentController@submit');
Route::post('register','StudentRegister@register');
Route::get('/dashboard', 'StudentRegister@getStudents');
EventController. php
class EventController extends Controller
{
public function submit(Request $request)
{
$message = new Event;
$message->title = $request->input('title');
$message->deadline = $request->input('deadline');
$message->message = $request->input('message');
$message->save();
return redirect('/dashboard')->with('status', 'Event Added');
}
public function getevent()
{
$msgevent = Event::orderBy('id', 'DESC')->get();
return view('dashboard')->with('dashboard', $msgevent);
}
}
studentRegister. php
public function getStudents(){
$Students = Student::all();
return view('dashboard') -> with('dashboard', $Students);
}
Они есть у меня в dashboard.blade. php
<div class="paginate-no-scroll 5">
<div class="items">
@if(count($dashboard) > 0)
@foreach ($dashboard as $msg)
<div>
<svg class="bd-placeholder-img mr-2 rounded" width="24" height="24" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: 32x32">
<rect width="30%" height="30%" fill="#007bff"/>
<text x="50%" y="50%" fill="#007bff" dy=".3em"></text>
</svg>
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
<strong class="d-block text-gray-dark">{{$msg -> title}}</strong> | {{$msg -> deadline}} |<b
style="color: #25027f"> @username</b> | <a href="#" style="text-decoration: underline;">Edit</a> |
<a href="/delete/{!! $msg -> id !!}" style="text-decoration: underline;">Delete</a><br>
{{$msg -> message}}
</div>
@endforeach
@endif
<table id="tableData" class="table table-bordered table-striped">
<thead>
<th>#</th>
<th>Student ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Action</th>
</thead>
@if(count($dashboard) > 0)
@foreach ($dashboard as $std)
<tr>
<td style="text-align:center"><img src="uploads/{{$std->image}}" style="width: 50px;height: 50px; border-radius: 50%" alt="{{$std->image}}"></td>
<td style="text-align:center; padding-top: 25px;">{{$std->studentID}}</td>
<td style="text-align:center; padding-top: 25px;">{{$std->fName}}</td>
<td style="text-align:center; padding-top: 25px;">{{$std->surName}}</td>
<td style="text-align:center; padding-top: 25px;"><a href="" class="btn btn-primary"> view</a>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>