Answer the question
In order to leave comments, you need to log in
How to merge requests in Laravel?
Good day.
I am studying laravel and faced such a problem that only 2 variables can be passed through return view, an error pops up on the 3rd one.
The question is how to pass three variables or how to combine queries into one.
Controller
public function showSite($site){
//в шаблоне не видно, но он подгружается через auth.layouts.app_auth
$insertSite = ['dataSite' => AddProject::distinct()
->where('user_id', Auth::id())
->get(['site'])];
$rezult = ['dataSiteOne' =>AddProject::where('site', $site)
->first('site')];
$table = ['table' => AddProject::where('user_id', Auth::id())
->where('site', $site)
->pluck('date')];
return view ('auth.show-site', $insertSite, $rezult, $table);
}
@extends('auth.layouts.app_auth')
@section('title')Статистика по проекту — {{$dataSiteOne->site}}@endsection
@section('content')
<h1>Статистика по проекту — {{$dataSiteOne->site}}</h1>
@foreach($table as $el)
<p>Дата — {{$el}}</p>
@endforeach
@endsection
Route::get('/show/{site}', '[email protected]')->name('show-site');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question