예제 #1
0
 /**
  * @param $team
  * @param Team $teams
  * @param Request $request
  * @return mixed
  */
 public function update($team, Team $teams, Request $request)
 {
     $team = $teams->find($team);
     if ($team) {
         $team->fill(translation_input($request, ['name']));
         $team->save();
         return $team;
     }
 }
예제 #2
0
 /**
  * @param AccountManager $accountManager
  * @param Team $team
  * @return \Illuminate\Contracts\View\View
  */
 public function index(AccountManager $accountManager, Team $team)
 {
     $account = $accountManager->account();
     $memberships = $account->memberships;
     //make sure to test all templates when changing these relations.
     //some templates show data by running through teams and others by running through memberships
     $memberships->load(['member', 'member.images', 'member.socialLinks', 'member.skills', 'member.skills.translations']);
     $teams = $team->with(['memberships', 'translations'])->whereHas('memberships', function ($query) {
         $query->whereNotNull('id');
     }, '>=')->get();
     return $this->theme->render('team.index', ['memberships' => $memberships, 'teams' => $teams]);
 }
예제 #3
0
 public function run()
 {
     foreach ([1, 2] as $account) {
         $teller = 0;
         $teams = new Collection();
         while ($teller < 3) {
             $teams->push(Team::create(['account_id' => $account, 'nl' => ['name' => $this->faker->sentence(2), 'description' => $this->faker->paragraph(5)], 'en' => ['name' => $this->faker->sentence(2), 'description' => $this->faker->paragraph(5)], 'fr' => ['name' => $this->faker->sentence(2), 'description' => $this->faker->paragraph(5)], 'de' => ['name' => $this->faker->sentence(2), 'description' => $this->faker->paragraph(5)]]));
             $teller++;
         }
         $account = Account::find($account);
         $teams = array_flip($teams->lists('id')->toArray());
         foreach ($account->memberships as $membership) {
             $membership->teams()->attach(array_rand($teams, rand(1, 3)));
         }
     }
 }