<?php

namespace App\Traits;
trait FilesProcessing
{

    /**
     * Get file
     */
    public function addFile($file)
    {
        // Set array
        $fileArray = [];

        // $size = $file->getSize();
        $uniqueFileName = uniqid() . '_' . $file->getClientOriginalName();
        $path = $file->move(public_path('vehicules'), $uniqueFileName);

        // return
        $fileArray = [
            'name'  =>  $uniqueFileName,
            'path'  =>  $path,
        ];

        // return
        return $fileArray;
    }
}
