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

            // Notify if file was not changed.
            if (\File::exists($path) and \File::get($path) == $content) {
                return response()->json([
                    'status' => false,
                    'message' => sprintf(__('msg.not_updated'), $template),
                ], 200);
            }

            \File::put($path, $content, true);

            return response()->json([
                'status' => true,
                'message' => sprintf(__('msg.updated'), $template),
                'file' => [
                    '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 );
        }
    }