public function add(NewMemberRequest $r, $project_id) { try { $Developer_id = Developer::where("email", $r->input("email"))->get()->first()->id; if ($Developer_id != null) { Member::create(["Developer_id" => $Developer_id, "project_id" => $project_id]); } } catch (\Illuminate\Database\QueryException $e) { } $members = DB::table('member')->where('project_id', $project_id)->join('Developer', 'member.Developer_id', '=', 'Developer.id')->get(); return view("member.show")->with('members', $members)->with('project_id', $project_id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $ntaches = Tache::all(); $whoDoWhat = array(); $taches = array(); $i = 0; foreach ($ntaches as $tache) { if ($tache->sprint_id == $id) { $taches[$i] = $tache; if ($tache->developer_id != null) { // $whoDoWhat[Developer::findOrFail($tache->developer_id)->attributesToArray()['FirstName']] = $tache; $whoDoWhat[$tache->id] = Developer::findOrFail($tache->developer_id)->attributesToArray()['FirstName']; } } $i++; //dd($whoDoWhat); } return view('kanban.index', compact('taches', 'id', 'whoDoWhat')); }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use Illuminate\Support\Facades\Route; use Laravel\Socialite\Facades\Socialite; use App\Developer; Route::get('/', function () { $developers = Developer::all(); return view("index", ["developers" => $developers]); }); Route::get("redirect/github", function () { return Socialite::with("github")->redirect(); }); Route::get("connect/github", function () { $data = Socialite::with("github")->user(); $developer = Developer::where("github_id", $data->id)->first(); if (!$developer) { Developer::create(["github_id" => $data->id, "github_nickname" => $data->nickname, "github_name" => $data->name, "github_email" => $data->email, "github_avatar" => $data->avatar]); } return redirect("/"); });
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $developer = Developer::find($id); if (Gate::denies('update-developer', $developer)) { abort(403); } $developer->name_en = $request->input('name_en'); $developer->name_jp = $request->input('name_jp'); $exec = $developer->save(); if ($exec) { return response()->json(['status' => 'success']); } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return Developer::create(['FirstName' => $data['FirstName'], 'FamilyName' => $data['FamilyName'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }
public function getDevelopers() { $developers = Developer::find(); return $developers; }