public function assign(AssignTeamMember $request) { $input = $request->get('teamMember'); $attributes = ['memberId' => array_get($input, 'memberId'), 'tournamentTeamId' => array_get($input, 'teamId')]; TeamMember::create($attributes); return $this->response->collection(TeamMember::where($attributes)->get(), new TeamMemberTransformer(), 'teamMembers'); }
/** * Run the migrations. * * @return void */ public function up() { // Schema::create('team_members', function (Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('slug'); $table->string('title'); $table->string('email'); $table->text('bio')->nullable(); $table->integer('priority'); $table->string('photo')->nullable(); $table->timestamps(); $table->timestamp('published')->nullable(); $table->softDeletes(); }); TeamMember::create(['first_name' => 'Alex', 'last_name' => 'Kaneen', 'slug' => 'kaneen-alex', 'title' => 'President & CEO', 'email' => '*****@*****.**', 'priority' => 1, 'photo' => '/images/team/kaneen-alex.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); TeamMember::create(['first_name' => 'Bob', 'last_name' => 'Fritz', 'slug' => 'fritz-bob', 'title' => 'Senior Vice President', 'email' => '*****@*****.**', 'priority' => 2, 'photo' => '/images/team/fritz-bob.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); TeamMember::create(['first_name' => 'Jeff', 'last_name' => 'Martin', 'slug' => 'martin-jeff', 'title' => 'VP Business Development', 'email' => '*****@*****.**', 'priority' => 3, 'photo' => '/images/team/martin-jeff.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); }
public function run() { DB::table('team_members')->delete(); /* Schema::create('team_members', function(Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('title'); $table->string('email'); $table->string('facebook')->nullable(); $table->string('twitter')->nullable(); $table->string('linkedin')->nullable(); $table->string('googleplus')->nullable(); $table->string('treehouse')->nullable(); $table->string('codeacademy')->nullable(); $table->text('about')->nullable(); $table->timestamps(); $table->timestamp('published_at')->nullable(); $table->softDeletes(); }); protected $fillable = [ 'first_name', 'last_name', 'title', 'email', 'facebook', 'twitter', 'linkedin', 'googleplus', 'treehouse', 'codeacademy', 'about', 'published_at', ]; */ TeamMember::create(['first_name' => 'Jeff', 'last_name' => 'Martin', 'title' => 'The Original Spartan Martin', 'email' => '*****@*****.**', 'linkedin' => '/in/spartanmartin', 'treehouse' => '/jeffmartin', 'published_at' => Carbon::now()]); }