show instead the code for the controller where you get all the chefs, and the blade file
use three backticks ``` before and after the code block
I am making a function in the controller to register chef, a type of a user. The user can upload a picture as well. Following is the code for that.
{
$chef = new chef();
$chef->name = $request->name;
$chef->company = $request->company;
$chef->email = $request->email;
$chef->password = $request->password;
$chef->address = $request->address;
$chef->number = $request->number;
$file = Input::file('picture');
$file -> move ('images', $file->getClientOriginalName());
$chef->picture = $request->file('picture');
echo '<img src"images/'. $file->getClientOriginalName(). '"/>"';
$chef->save();
return view("checkimage")->with('chef', $chef);
}
It's working perfectly fine till here. The next step is to display the users.
Following is the code for that blade.
{ @foreach($chef as $chefs) {{ $chefs->name }}
@endforeach } However, it's showing an error. Trying to get property of non-object. I have tried everything, but it's not being fixed. Please tell me a solution.
Please or to participate in this conversation.