public function edit(TemplateRequest $request, $template)
    {
        try {
            $template = $request->template;
            $path = theme_path('views').$template;

            return response()->json([
                'status' => true, 'message' => null,
                'file' => [
                    'content' => \File::get($path),
                    'size' => formatBytes(\File::size($path)),
                    'modified' => strftime('%Y-%m-%d %H:%M', \File::lastModified($path))
                ]
            ], 200);

        } catch (ValidationException $e) {
            $message = $e->validator->errors()->first();
            return response()->json(['status' => false, 'message' => $message], 200);
        } catch (\Exception $e) {
            $message = $e->getMessage();
            return response()->json(['status' => false, 'message' => $message], 404 );
        }
    }
public function edit(TemplateRequest $request, $template)
    {
        try {
            $template = $request->template;
            $path = theme_path('views').$template;

            return response()->json([
                'status' => true, 'message' => null,
                'file' => [
                    'content' => \File::get($path),
                    'size' => formatBytes(\File::size($path)),
                    'modified' => strftime('%Y-%m-%d %H:%M', \File::lastModified($path))
                ]
            ], 200);

        } catch (ValidationException $e) {
            $message = $e->validator->errors()->first();
            return response()->json(['status' => false, 'message' => $message], 200);
        } catch (\Exception $e) {
            $message = $e->getMessage();
            return response()->json(['status' => false, 'message' => $message], 404 );
        }
    }
public function edit ( TemplateRequest $ request , $ template ) { try { $ template = $ request -> template ; $ path = theme_path ( 'views' ) . $ template ; return response ( ) -> json ( [ 'status' => true , 'message' => null , 'file' => [ 'content' => \ File :: get ( $ path ) , 'size' => formatBytes ( \ File :: size ( $ path ) ) , 'modified' => strftime ( '%Y-%m-%d %H:%M' , \ File :: lastModified ( $ path ) ) ] ] , 200 ) ; } catch ( ValidationException $ e ) { $ message = $ e -> validator -> errors ( ) -> first ( ) ; return response ( ) -> json ( [ 'status' => false , 'message' => $ message ] , 200 ) ; } catch ( \ Exception $ e ) { $ message = $ e -> getMessage ( ) ; return response ( ) -> json ( [ 'status' => false , 'message' => $ message ] , 404 ) ; } }
Edit template file by path.
Edit template file by path .