jeudi 9 février 2023

syntax error, unexpected token "}" LARAVEL

I got error in my Laravel controller that says syntax error, unexpected token "}", i have checked every line but couldn't identified the error reason.

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Dompdf\Dompdf;

class WordController extends Controller
{
    public function importForm()
    {
        return view('import');
    }

    public function importWord(Request $request)
    {
        $file_path = $request->file('word_file')->getRealPath();

        try {
            $word = new COM("Word.Application") or die("Unable to instantiate Word");
            $word->Visible = 0;
            $word->Documents->Open($file_path);
            $content = $word->ActiveDocument->Content->Text;
            $word->Quit();
            $word = null;
            unset($word);
        } catch (Exception $e) {
            return redirect()->back()->with('error', 'An error occurred while importing the Word document');
        }

        $dompdf = new Dompdf();
        $dompdf->loadHtml($content);
        $dompdf->setPaper('A4', 'portrait');
        $dompdf->render();

        return $dompdf->stream();
        }
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/IPQzeYp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire