<?php

namespace App\Traits;

Trait  allTraits
{
     function saveImage($photo, $folder){
        //save photo in folder

        $file_extension = $photo->getClientOriginalExtension();
        $file_name = time().'.'.$file_extension;
        $path = $folder;
        $photo -> move($path,$file_name);
        return $file_name;

    }





    function saveImageCv($cv, $folder){
        //save photo in folder

        $file_extension = $cv->getClientOriginalExtension();
        $file_nameCV = time().'.'.$file_extension;
        $path = $folder;
        $cv -> move($path,$file_nameCV);
        return $file_nameCV;
    }





    function saveImageNationalID($NationalID, $folder){
        //save photo in folder

        $file_extension = $NationalID->getClientOriginalExtension();
        $file_nameNationalID = time().'.'.$file_extension;
        $path = $folder;
        $NationalID -> move($path,$file_nameNationalID);
        return $file_nameNationalID;
    }





    function saveImagePost($image, $folder){
        //save photo in folder

        $file_extension = $image->getClientOriginalExtension();
        $file_name = time().'.'.$file_extension;
        $path = $folder;
        $image -> move($path,$file_name);
        return $file_name;

    }


    function saveCard($idImg, $folder){
        //save photo in folder

        $file_extension = $idImg->getClientOriginalExtension();
        $file_name2 = time().'.'.$file_extension;
        $path = $folder;
        $idImg -> move($path,$file_name2);
        return $file_name2;

    }


    function saveMainImage($MainPhoto, $folder){
        //save photo in folder
        $file_extension = $MainPhoto->getClientOriginalExtension();
        $file_nameMain = time().'.'.$file_extension;
        $path = $folder;
        $MainPhoto -> move($path,$file_nameMain);
        return $file_nameMain;
    }



    function saveImageIcon($icon, $folder){

        $file_extension = $icon->getClientOriginalExtension();
        $file_name2 = time().'.'.$file_extension;
        $path = $folder;
        $icon -> move($path,$file_name2);
        return $file_name2;

    }

}
