profile index controller
public function index($id)
{
$view = Pg::where('user_id','=',$id)->first();
$doc = Document::where('pg_id','=',$view->id)->get();
returnview('admin.pages.pg.viewprofile',compact('user','managment','owner','country','countries','doc','view','city','state'));
}
here is my store method
public function destroy($id)
{
$doc = Pg::where('id',$id)->first();
$document = Document::where('pg_id',$doc->id)->first();
$doc_path = public_path().'/PG/Doc/'.$id.'/'.$doc->multiple_doc; // Value is not URL but directory file path
if(File::exists($doc_path)) {
File::delete($doc_path);
}
$document->delete();
notify()->success('Profile Document Remove Successfully !');
return back();
}