vendredi 1 mars 2019

Laravel 5 How to delete file which is inside resources/view?

I'm a newbie in Laravel framework.

Here is my purpose:-

I stored a report file in HTML format inside view folder because I need to restrict access to this view. Currently, I route and send a parameter of a blade file parsing to my controller.

My controller delete function as follows:-

public function centos7_delete($id)
{
    //
    $user = Auth::user();
    if($user){
        \File::Delete('/resources/views/report/centos7/'. $id);
        echo '/resources/views/report/centos7/'. $id;
        return view('centos7dir');
    } else {
        return redirect('/permission_denied');
    }
}

An example filename which is routed and parsed to Controller.

result_target2.blade.php

I'm not sure, how many ways to do it on the Laravel framework? Please help me suggest or provide some guidelines.

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire