Check the laravel log
PAss data from controller to view
invoiceController
class InvoiceController extends Controller
{
public function step1(Request $request)
{
$request->validate([
'invoice' => 'required|numeric',
'telNumber' => 'required|numeric',
]);
// $invoice = Invoice::with('items')->where('number' ,$request->invoice)->where('tel' ,$request->telNumber)->first();
$invoice = Invoice::where('number' ,$request->invoice)->where('tel' ,$request->telNumber)->first();
if($invoice) {
return redirect('/step2')->with('invoice_id', $invoice->id);
}
return back()->with('top','Incorrect invoice or / and telephone number');
}
public function step2(Request $request)
{
$invoice_id = session('invoice_id');
$invoiceWithItems = Invoice::with('items')->find($invoice_id);
if($invoiceWithItems){
// return $invoiceWithItems;
return view('pages.guest.step2page',compact('invoiceWithItems'));
}
return back()->with('top','Incorrect invoice data');
}
}
step2page.blade.php
@extends('layout.guest')
@section('content')
@include('layout.stepper',['step'=> 2])
@include('layout.step2', ['invoiceWithItems' => $invoiceWithItems])
@endsection
step2.blade.php
@extends('pages.guest.step2page')
@section('content')
{{ $invoiceWithItems }}
@endsection
there is 500 server error i do not know ehy ? I should mention that in step.blade.php if i return $invoiceWithItems it returned very good as a json data . but not pass to view .. i dunno why !
@lifesound but that's not what you posted earlier...
Here's some advice for you. Simplify. You're all over the place with your templates and layouts. Simplify the view you are returning by removing all @extends @includes directives. Make sure that the view will render with the data it needs; it will be ugly (and that's fine). Progressively reintroduce the other templates, layouts etc. and when an error occurs, diagnose that error
Please or to participate in this conversation.