コード例 #1
0
 /**
  * Tests translations for nested relationship collections.
  */
 public function testTranslationsForCollectionsOfCollections()
 {
     $categories = Category::with('content')->get();
     $translated = Translator::translate($categories);
     $this->assertCount(2, $categories);
     $this->assertEquals('Football', $translated->last()->trans('en_GB', 'title'));
     $this->assertEquals('This is what we shall do', $translated[0]->content[0]->trans('en_GB', 'title'));
 }
コード例 #2
0
 /**
  * Returns the account entity, which has been translated from the original model - which can be used
  * for dealing with the account name and any other fields that are translated to a user's locality.
  *
  * @return Entity
  */
 public function translated()
 {
     if (!$this->translatedAccount) {
         $this->translatedAccount = Translator::translate($this->account);
     }
     return $this->translatedAccount;
 }
コード例 #3
0
ファイル: RoleController.php プロジェクト: kamaroly/shift
 /**
  * Retrieve a single role.
  *
  * @Get("roles/{slug}", middleware={"shift.account", "shift.auth"}, as="roles.show")
  *
  * @param $slug
  * @return mixed
  */
 public function getShow($slug)
 {
     $role = Translator::translate($this->roleRepository->requireBySlug($slug));
     return $this->respond('shift::roles.edit', compact('role'));
 }
コード例 #4
0
ファイル: AccountController.php プロジェクト: kamaroly/shift
 /**
  * Retrieve a single account based on the slug provided.
  *
  * @Get("accounts/{slug}", middleware={"shift.account", "shift.auth"}, as="accounts.show")
  *
  * @param $slug
  */
 public function getShow($slug)
 {
     $account = Translator::translate($this->accountRepository->requireBySlug($slug));
     return $this->respond('shift::accounts.edit', compact('account'));
 }