Esempio n. 1
0
 /**
  * Show all resource that belong to a category.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function userResources()
 {
     $categories = Category::all();
     $user = Auth::user();
     $resources = $this->resourceRepository->findResourcesByUser($user);
     $title = 'Resource(s) for ' . $user->firstname . ' ' . $user->lastname;
     return view('pages.resources', compact('categories', 'resources', 'title'));
 }
Esempio n. 2
0
<?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.
|
*/
Route::get('/', ['as' => 'index', function () {
    $categories = \AndeCollege\Category::all();
    $resources = \AndeCollege\Resource::all();
    return view('pages.resources', compact('categories', 'resources'));
}]);
Route::get('/login', ['as' => 'getLogin', function () {
    return view('auth.login');
}]);
Route::post('/login', ['as' => 'postLogin', 'uses' => 'Auth\\AuthController@doLogin']);
Route::get('/login/{provider}', ['as' => 'login.social', 'uses' => 'Auth\\AuthController@socialLogin', 'middleware' => ['guest']]);
Route::get('/logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@getLogout', 'middleware' => ['auth']]);
Route::get('/register', ['as' => 'getRegister', 'middleware' => ['guest'], function () {
    return view('auth.register');
}]);
Route::post('/register', ['as' => 'postRegister', 'uses' => 'Auth\\AuthController@postRegister', 'middleware' => ['guest']]);
Route::get('/logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@getLogout', 'middleware' => ['auth']]);
Route::get('/social', ['as' => 'get.social', 'uses' => 'Auth\\AuthController@getSocial', 'middleware' => ['guest']]);
Route::get('/social/twitter', ['as' => 'get.social.twitter', 'uses' => 'Auth\\AuthController@getSocialTwitter', 'middleware' => ['guest']]);
Route::post('/social', ['as' => 'post.social', 'uses' => 'Auth\\AuthController@postSocial', 'middleware' => ['guest']]);
Esempio n. 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(CategoryCreateRequest $request)
 {
     Category::create(['name' => $request->input('name'), 'user_id' => Auth::user()->id]);
     return redirect(route('category.create'))->with('status', 'Category Created Successfully');
 }
Esempio n. 4
0
 /**
  * Find Users by their Emails
  * @param  string $email
  * @return Collection
  */
 public function findCategoryByName($name)
 {
     return Category::where('name', '=', $name)->first();
 }