hope you all right. I am working on a project in laravel where i have to store user logo in MYSql database and retrieve when user demand. I successfully stored logo path in database now i want to show it on a view but unlucky i can't. Logos are stored in 'storage/app/public/'. I tried asset function and all the possible ways i find on google and stackoverflow but no luck.
Controller function to store
public function store(Request $request)
{
$path = $request->file('logo')->store('public');
$company = new company;
$company->name = $request->input('name');
$company->email = $request->input('email');
$company->website = $request->input('website');
$company->logo = $path;
$company->save();
$request->session()->flash('status', 'New Record added successfully');
return redirect('company');
}
View
@foreach($data as $company)
<tr>
<th scope="row">{{ $company->name }}</th>
<td>{{ $company->email }}</td>
<td>
<img src="{{ asset($company->logo) }}" alt="" style="width:100px; height:100px;">
</td>
<td> {{ $company->website }}</td>
<td>
<a href="{{ URL::to('company/'. $company->id. '/edit') }}">Edit</a>
<a href="{{ URL::to('company/'. $company->id. '/destroy') }}">Delete</a>
</td>
</tr>
@endforeach
Where i am wrong??? Any help will be highly appreciated :)
$company->logoits not save currectlylogofield oncompaniestable. do you check it correct or not?