Want to fetch array on laravel, The Document is
{
"_id" : ObjectId("5b030a1b5085321e84006eff"),
"name" : "Amalendu kar",
"Information" : {
"email" : "amalkar@gmail.com",
"comment" : "Ok",
"website" : "example.com",
"info" : {
"x" : 203,
"y" : 102
},
"versions" : [
"0.9.7",
"0.9.8",
"0.9.9"
]
},
"updated_at" : ISODate("2018-05-21T18:04:11Z"),
"created_at" : ISODate("2018-05-21T18:04:11Z")
}
and i ausing this command to save this
public function store(Request $request)
{
request()->validate([
'name' => 'required',
'email' => 'required',
'website' => 'required',
'comment' => 'required',
'gender' => 'required',
]);
//Data::insert($request->all());
Data::create(['name' => $request->input('name'),
"Information"=>[
"email" => $request->input('email'),
"comment" => $request->input('comment'),
'website' =>$request->input('website'),
"info" => (object)array( "x" => 203, "y" => 102),
"versions" => array("0.9.7", "0.9.8", "0.9.9")
]
]);
return redirect('/') ->with( 'success', ' Done! ');
}
Now i want to fetch 'name' field and 'email' from Infromation here is the code but i am getting error.
@foreach ($data as $value)
<h1></h1>
@foreach ($content as $key)
<h1></h1>
@endforeach
@endforeach
Getting this error
"htmlspecialchars() expects parameter 1 to be string,
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2rYk6j9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire