multiple enviournment files laravel code example

Example 1: Laravel store multiple files

public function fileUpload(Request $request)
    {
        if ($request->hasfile('filenames')) {
            foreach ($request->file('filenames') as $file) {
                $name = $file->getClientOriginalName();
                $file->move(public_path() . '/mytestfile/', $name);
                $data[] = $name;
            }
            return back()->with('Success!','Data Added!');
        }
    }

Example 2: get env app url laravel

env('APP_URL')

Example 3: laravel APP_ENV config

if (\Illuminate\Support\Facades\App::environment('production')) {
    // The environment is production
}

Tags:

Php Example