diff options
author | devianl2 <devianleong@gmail.com> | 2022-02-13 21:07:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-13 21:07:28 +0800 |
commit | 4a71aee0ab56a8450f5791554d06f544f6be1157 (patch) | |
tree | f899aaab754cf6708a823e33179b7167b3a6b079 /README.md | |
parent | 88d7940d4db9519c046f8c5375ef092da1daab35 (diff) | |
parent | 4a36318e1ba5b5d50afe0a7991168df26945f52d (diff) |
Merge pull request #11 from KhaledLela/handle_publish_translations3.0.2
Handle publish translations for scorm runtime exceptions handler
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 52 |
1 files changed, 51 insertions, 1 deletions
@@ -44,7 +44,7 @@ php artisan migrate ``` ## Step 5 (Optional): -update SCORM config under config/scorm +***Update SCORM config under `config/scorm`*** - update scorm table names. - update SCORM disk and configure disk @see config/filesystems.php ``` @@ -71,3 +71,53 @@ update SCORM config under config/scorm ..... ] ``` +***Update SCORM translations under `resources/lang/en-US/scorm.php`*** +- SCORM runtime errors exceptions handler, *(Check next example)* +- Copy and translate error msg with key for other locale as you wish. + +*After finishing don't forget to run `php artisan config:cache`* + + +## Step 6 (Optional): + +**Usage** +``` +class ScormController extends BaseController +{ + /** @var ScormManager $scormManager */ + private $scormManager; + /** + * ScormController constructor. + * @param ScormManager $scormManager + */ + public function __construct(ScormManager $scormManager) + { + $this->scormManager = $scormManager; + } + + public function show($id) + { + $item = ScormModel::with('scos')->findOrFail($id); + // response helper function from base controller reponse json. + return $this->respond($item); + } + + public function store(ScormRequest $request) + { + try { + $scorm = $this->scormManager->uploadScormArchive($request->file('file')); + // handle scorm runtime error msg + } catch (InvalidScormArchiveException | StorageNotFoundException $ex) { + return $this->respondCouldNotCreateResource(trans('scorm.' . $ex->getMessage())); + } + + // response helper function from base controller reponse json. + return $this->respond(ScormModel::with('scos')->whereUuid($scorm['uuid'])->first()); + } + + public function saveProgress(Request $request) + { + // TODO save user progress... + } +} +```
\ No newline at end of file |