public function get($id)
 {
     $article = Member::with('command')->find($id);
     if (!$article) {
         return response()->json(null, 404);
     }
     return response()->json($article);
 }
Beispiel #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     try {
         $result = Member::with('memberships')->findOrFail($id);
         return response()->json($result);
     } catch (ModelNotFoundException $e) {
         return new JsonResponse(['error' => 'not found'], Response::HTTP_NOT_FOUND);
     }
 }
Beispiel #3
0
 public function membersCsv()
 {
     if (Gate::denies('admin')) {
         Auth::logout();
         return redirect('/admin/login');
     }
     $members = Member::with('group')->get();
     $columns = ['id', 'email', 'first_name', 'last_name', 'country', 'group.name', 'created_at', 'birthdate', 'faculty'];
     $headers = ['ID', 'Email', 'First Name', 'Last Name', 'Country', 'Team Name', 'Registered At', 'Birthdate', 'Faculty/School'];
     $csv = $this->exportCsv($members, $columns, $headers);
     $csvName = 'eca-members-' . date('Y-m-d-His') . '.csv';
     return response($csv, 200, ['Content-type' => 'text/csv', 'Content-Disposition' => sprintf('attachment; filename="%s"', $csvName), 'Content-Length' => strlen($csv)]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data = Member::with('person.contacts', 'person.files', 'person.education')->paginate(50);
     return view('admin.index', compact('data'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request, $id)
 {
     // Fetch the first match
     // detail -- [ high | med | low ]
     $detailLevel = $request->input('detail', 'low');
     // Todo: Add $detailLevel == med
     try {
         if ($detailLevel == 'high') {
             // Todo: to add more "eager loaded" relationshions, add extra args to Member::with()
             $member = Member::with('postings')->where('regt_num', $id)->withTrashed()->firstOrFail();
         } else {
             //  when $detailLevel == low
             $member = Member::where('regt_num', $id)->withTrashed()->firstOrFail();
         }
         return response()->json(['member' => $member->toArray()]);
     } catch (\Exception $ex) {
         return response()->json(['error' => ['code' => $ex->getCode(), 'reason' => $ex->getMessage()]], 404);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return Member::with(['experiences' => function ($query) {
         $query->with('project');
     }])->where('id', $id)->first();
 }
Beispiel #7
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $member = Member::with('contacts', 'projects', 'sector')->find($id);
     return view('members.show', compact('member'));
 }
Beispiel #8
0
 public function index()
 {
     return view('committee/table', ['membersJson' => Member::with('college', 'course', 'scholarship')->get()->map(function ($member) {
         return $member->setAllVisible();
     })->toJson()]);
 }
Beispiel #9
0
|--------------------------------------------------------------------------
|
| 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.
|
*/
Route::get('/home', function () {
    return view('welcome');
});
Route::get('/', function () {
    return view('welcome');
});
Route::get('/members/frontend', function () {
    //    Approved()->
    $members = \App\Member::with('sector')->approved()->get();
    return view('members.frontend', compact('members'));
});
Route::get('/thanks', ['as' => 'thank.you', function () {
    return view('members.thanks');
}]);
Route::group(['middleware' => 'auth'], function () {
    Route::get('members/create', ['uses' => 'MembersController@Create', 'as' => 'members.create']);
    Route::get('members/links/{id}', ['uses' => 'MembersController@AddLinks', 'as' => 'members.links']);
    Route::get('members/projects/{id}', ['uses' => 'MembersController@AddProjects', 'as' => 'members.projects']);
    Route::post('members/links/{id}', ['uses' => 'MembersController@SaveLinks', 'as' => 'members.links.save']);
    Route::post('member/project/{id}/save', ['uses' => 'MembersController@SaveProject', 'as' => 'members.project.save']);
    Route::post('members', ['uses' => 'MembersController@store', 'as' => 'members.save']);
    Route::get('members/', ['uses' => 'MembersController@index', 'as' => 'members.view']);
    Route::get('members/approve/{id}', ['uses' => 'MembersController@approve', 'as' => 'members.approve']);
});
Beispiel #10
0
 public function show()
 {
     return view('directory/table', ['membersJson' => Member::with('college', 'course')->get()->toJson()]);
 }