diff options
author | Khaled Lela <eng.khaled.lela@gmail.com> | 2022-02-11 20:31:17 +0200 |
---|---|---|
committer | Khaled Lela <eng.khaled.lela@gmail.com> | 2022-02-11 20:31:17 +0200 |
commit | 7e58d0fda2b0db301e59703a652f5caf40f4718a (patch) | |
tree | 5ad0ae137d0385acf8c78a1ae1ffac6569a9bdc0 | |
parent | 5eba0307dbdd15d1a215419ff9fd3e3f96f99f0e (diff) |
update readme with translation part and usage example.
-rw-r--r-- | README.md | 54 |
1 files changed, 53 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,55 @@ update SCORM config under config/scorm ..... ] ``` +***Update SCORM transaltions under `resources/lang/en-US`*** +- 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 |