@@ 19-48 (lines=30) @@ | ||
16 | use Longman\Platfourm\Service\EntityService; |
|
17 | use Longman\Platfourm\Text\Repositories\Eloquent\TextRepository; |
|
18 | ||
19 | class AutosaveTextsService extends EntityService |
|
20 | { |
|
21 | protected $repository; |
|
22 | protected $authUserService; |
|
23 | protected $config; |
|
24 | ||
25 | public function __construct( |
|
26 | AuthUserService $authUserService, |
|
27 | TextRepository $repository, |
|
28 | Config $config |
|
29 | ) { |
|
30 | $this->authUserService = $authUserService; |
|
31 | $this->repository = $repository; |
|
32 | $this->config = $config; |
|
33 | } |
|
34 | ||
35 | public function run($lang, $scope, array $data) |
|
36 | { |
|
37 | $this->checkRepository(); |
|
38 | ||
39 | try { |
|
40 | $locales = $this->config->get('multilang.locales', []); |
|
41 | $status = $this->repository->autosave($locales, $lang, $scope, $data); |
|
42 | } catch (Exception $e) { |
|
43 | return false; |
|
44 | } |
|
45 | ||
46 | return $status; |
|
47 | } |
|
48 | } |
|
49 |
@@ 19-48 (lines=30) @@ | ||
16 | use Longman\Platfourm\Service\EntityService; |
|
17 | use Longman\Platfourm\Text\Repositories\Eloquent\TextRepository; |
|
18 | ||
19 | class AutosaveTextsService extends EntityService |
|
20 | { |
|
21 | protected $repository; |
|
22 | protected $authUserService; |
|
23 | protected $config; |
|
24 | ||
25 | public function __construct( |
|
26 | AuthUserService $authUserService, |
|
27 | TextRepository $repository, |
|
28 | Config $config |
|
29 | ) { |
|
30 | $this->authUserService = $authUserService; |
|
31 | $this->repository = $repository; |
|
32 | $this->config = $config; |
|
33 | } |
|
34 | ||
35 | public function run($lang, $scope, array $data) |
|
36 | { |
|
37 | $this->checkRepository(); |
|
38 | ||
39 | try { |
|
40 | $locales = $this->config->get('multilang.locales', []); |
|
41 | $status = $this->repository->autosave($locales, $lang, $scope, $data); |
|
42 | } catch (Exception $e) { |
|
43 | return false; |
|
44 | } |
|
45 | ||
46 | return $status; |
|
47 | } |
|
48 | } |
|
49 |