Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/Controllers/Admin/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class CategoriesController extends BaseController
/**
* Create a new CategoriesController instance.
*
* @param \Tricks\Repositories\CategoryRepositoryInterface $categories
* @param \Tricks\Repositories\CategoryRepositoryInterface $categories
*
* @return void
*/
public function __construct(CategoryRepositoryInterface $categories)
Expand Down Expand Up @@ -49,7 +50,7 @@ public function postIndex()
{
$form = $this->categories->getForm();

if (! $form->isValid()) {
if (!$form->isValid()) {
return $this->redirectRoute('admin.categories.index')
->withErrors($form->getErrors())
->withInput();
Expand Down Expand Up @@ -79,7 +80,8 @@ public function postArrange()
/**
* Show the category edit form.
*
* @param mixed $id
* @param mixed $id
*
* @return \Response
*/
public function getView($id)
Expand All @@ -92,14 +94,15 @@ public function getView($id)
/**
* Handle the editing of a category.
*
* @param mixed $id
* @param mixed $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postView($id)
{
$form = $this->categories->getForm();

if (! $form->isValid()) {
if (!$form->isValid()) {
return $this->redirectRoute('admin.categories.view', $id)
->withErrors($form->getErrors())
->withInput();
Expand All @@ -113,7 +116,8 @@ public function postView($id)
/**
* Delete a category from the database.
*
* @param mixed $id
* @param mixed $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function getDelete($id)
Expand Down
16 changes: 10 additions & 6 deletions app/Controllers/Admin/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class TagsController extends BaseController
/**
* Create a new TagsController instance.
*
* @param \Tricks\Repositories\TagRepositoryInterface $tags
* @param \Tricks\Repositories\TagRepositoryInterface $tags
*
* @return void
*/
public function __construct(TagRepositoryInterface $tags)
Expand All @@ -42,7 +43,8 @@ public function getIndex()
/**
* Delete a tag from the database.
*
* @param mixed $id
* @param mixed $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function getDelete($id)
Expand All @@ -55,7 +57,8 @@ public function getDelete($id)
/**
* Show the tag edit form.
*
* @param mixed $id
* @param mixed $id
*
* @return \Response
*/
public function getView($id)
Expand All @@ -74,7 +77,7 @@ public function postIndex()
{
$form = $this->tags->getForm();

if (! $form->isValid()) {
if (!$form->isValid()) {
return $this->redirectRoute('admin.tags.index')
->withErrors($form->getErrors())
->withInput();
Expand All @@ -88,14 +91,15 @@ public function postIndex()
/**
* Handle the editing of a tag.
*
* @param mixed $id
* @param mixed $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postView($id)
{
$form = $this->tags->getForm();

if (! $form->isValid()) {
if (!$form->isValid()) {
return $this->redirectRoute('admin.tags.view', $id)
->withErrors($form->getErrors())
->withInput();
Expand Down
3 changes: 2 additions & 1 deletion app/Controllers/Admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class UsersController extends BaseController
/**
* Create a new UsersController instance.
*
* @param \Tricks\Repositories\UserRepositoryInterface $users
* @param \Tricks\Repositories\UserRepositoryInterface $users
*
* @return void
*/
public function __construct(UserRepositoryInterface $users)
Expand Down
25 changes: 13 additions & 12 deletions app/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class AuthController extends BaseController
/**
* Create a new AuthController instance.
*
* @param \Tricks\Repositories\UserRepositoryInterface $users
* @param \Tricks\Repositories\UserRepositoryInterface $users
*
* @return void
*/
public function __construct(UserRepositoryInterface $users)
Expand All @@ -48,8 +49,8 @@ public function getLogin()
*/
public function postLogin()
{
$credentials = Input::only([ 'username', 'password' ]);
$remember = Input::get('remember', false);
$credentials = Input::only(['username', 'password']);
$remember = Input::get('remember', false);

if (str_contains($credentials['username'], '@')) {
$credentials['email'] = $credentials['username'];
Expand All @@ -60,7 +61,7 @@ public function postLogin()
return $this->redirectIntended(route('user.index'));
}

return $this->redirectBack([ 'login_errors' => true ]);
return $this->redirectBack(['login_errors' => true]);
}

/**
Expand All @@ -82,14 +83,14 @@ public function postRegister()
{
$form = $this->users->getRegistrationForm();

if (! $form->isValid()) {
return $this->redirectBack([ 'errors' => $form->getErrors() ]);
if (!$form->isValid()) {
return $this->redirectBack(['errors' => $form->getErrors()]);
}

if ($user = $this->users->create($form->getInputData())) {
Auth::login($user);

return $this->redirectRoute('user.index', [], [ 'first_use' => true ]);
return $this->redirectRoute('user.index', [], ['first_use' => true]);
}

return $this->redirectRoute('home');
Expand All @@ -102,8 +103,8 @@ public function postRegister()
*/
public function getLoginWithGithub()
{
if (! Input::has('code')) {
Session::keep([ 'url' ]);
if (!Input::has('code')) {
Session::keep(['url']);
GithubProvider::authorize();
} else {
try {
Expand All @@ -112,14 +113,14 @@ public function getLoginWithGithub()

if (Session::get('password_required')) {
return $this->redirectRoute('user.settings', [], [
'update_password' => true
'update_password' => true,
]);
}

return $this->redirectIntended(route('user.index'));
} catch (GithubEmailNotVerifiedException $e) {
return $this->redirectRoute('auth.register', [
'github_email_not_verified' => true
'github_email_not_verified' => true,
]);
}
}
Expand All @@ -134,6 +135,6 @@ public function getLogout()
{
Auth::logout();

return $this->redirectRoute('auth.login', [], [ 'logout_message' => true ]);
return $this->redirectRoute('auth.login', [], ['logout_message' => true]);
}
}
24 changes: 14 additions & 10 deletions app/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Controllers;

use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;

class BaseController extends Controller
{
Expand All @@ -22,7 +22,7 @@ class BaseController extends Controller
*/
public function __construct()
{
$this->beforeFilter('csrf', [ 'on' => 'post' ]);
$this->beforeFilter('csrf', ['on' => 'post']);
}

/**
Expand All @@ -32,16 +32,17 @@ public function __construct()
*/
protected function setupLayout()
{
if (! is_null($this->layout)) {
if (!is_null($this->layout)) {
$this->layout = View::make($this->layout);
}
}

/**
* Set the specified view as content on the layout.
*
* @param string $path
* @param array $data
* @param string $path
* @param array $data
*
* @return void
*/
protected function view($path, $data = [])
Expand All @@ -52,9 +53,10 @@ protected function view($path, $data = [])
/**
* Redirect to the specified named route.
*
* @param string $route
* @param array $params
* @param array $data
* @param string $route
* @param array $params
* @param array $data
*
* @return \Illuminate\Http\RedirectResponse
*/
protected function redirectRoute($route, $params = [], $data = [])
Expand All @@ -65,7 +67,8 @@ protected function redirectRoute($route, $params = [], $data = [])
/**
* Redirect back with old input and the specified data.
*
* @param array $data
* @param array $data
*
* @return \Illuminate\Http\RedirectResponse
*/
protected function redirectBack($data = [])
Expand All @@ -76,7 +79,8 @@ protected function redirectBack($data = [])
/**
* Redirect a logged in user to the previously intended url.
*
* @param mixed $default
* @param mixed $default
*
* @return \Illuminate\Http\RedirectResponse
*/
protected function redirectIntended($default = null)
Expand Down
33 changes: 18 additions & 15 deletions app/Controllers/BrowseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Controllers;

use Tricks\Repositories\CategoryRepositoryInterface;
use Tricks\Repositories\TagRepositoryInterface;
use Tricks\Repositories\TrickRepositoryInterface;
use Tricks\Repositories\CategoryRepositoryInterface;

class BrowseController extends BaseController
{
Expand Down Expand Up @@ -32,9 +32,10 @@ class BrowseController extends BaseController
/**
* Create a new BrowseController instance.
*
* @param \Tricks\Repositories\CategoryRepositoryInterface $categories
* @param \Tricks\Repositories\TagRepositoryInterface $tags
* @param \Tricks\Repositories\TrickRepositoryInterface $tricks
* @param \Tricks\Repositories\CategoryRepositoryInterface $categories
* @param \Tricks\Repositories\TagRepositoryInterface $tags
* @param \Tricks\Repositories\TrickRepositoryInterface $tricks
*
* @return void
*/
public function __construct(
Expand All @@ -45,8 +46,8 @@ public function __construct(
parent::__construct();

$this->categories = $categories;
$this->tags = $tags;
$this->tricks = $tricks;
$this->tags = $tags;
$this->tricks = $tricks;
}

/**
Expand All @@ -64,15 +65,16 @@ public function getCategoryIndex()
/**
* Show the browse by category page.
*
* @param string $category
* @param string $category
*
* @return \Response
*/
public function getBrowseCategory($category)
{
list($category, $tricks) = $this->tricks->findByCategory($category);

$type = \Lang::get('browse.category', array('category' => $category->name));
$pageTitle = \Lang::get('browse.browsing_category', array('category' => $category->name));
$type = \Lang::get('browse.category', ['category' => $category->name]);
$pageTitle = \Lang::get('browse.browsing_category', ['category' => $category->name]);

$this->view('browse.index', compact('tricks', 'type', 'pageTitle'));
}
Expand All @@ -92,15 +94,16 @@ public function getTagIndex()
/**
* Show the browse by tag page.
*
* @param string $tag
* @param string $tag
*
* @return \Response
*/
public function getBrowseTag($tag)
{
list($tag, $tricks) = $this->tricks->findByTag($tag);

$type = \Lang::get('browse.tag', array('tag' => $tag->name));
$pageTitle = \Lang::get('browse.browsing_tag', array('tag' => $tag->name));
$type = \Lang::get('browse.tag', ['tag' => $tag->name]);
$pageTitle = \Lang::get('browse.browsing_tag', ['tag' => $tag->name]);

$this->view('browse.index', compact('tricks', 'type', 'pageTitle'));
}
Expand All @@ -114,7 +117,7 @@ public function getBrowseRecent()
{
$tricks = $this->tricks->findMostRecent();

$type = \Lang::get('browse.recent');
$type = \Lang::get('browse.recent');
$pageTitle = \Lang::get('browse.browsing_most_recent_tricks');

$this->view('browse.index', compact('tricks', 'type', 'pageTitle'));
Expand All @@ -129,7 +132,7 @@ public function getBrowsePopular()
{
$tricks = $this->tricks->findMostPopular();

$type = \Lang::get('browse.popular');
$type = \Lang::get('browse.popular');
$pageTitle = \Lang::get('browse.browsing_most_popular_tricks');

$this->view('browse.index', compact('tricks', 'type', 'pageTitle'));
Expand All @@ -144,7 +147,7 @@ public function getBrowseComments()
{
$tricks = $this->tricks->findMostCommented();

$type = \Lang::get('browse.most_commented');
$type = \Lang::get('browse.most_commented');
$pageTitle = \Lang::get('browse.browsing_most_commented_tricks');

$this->view('browse.index', compact('tricks', 'type', 'pageTitle'));
Expand Down
3 changes: 2 additions & 1 deletion app/Controllers/FeedsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class FeedsController extends BaseController
/**
* Create a new FeedsController instance.
*
* @param \Tricks\Services\Feeds\Builder $builder
* @param \Tricks\Services\Feeds\Builder $builder
*
* @return void
*/
public function __construct(Builder $builder)
Expand Down
Loading