Skip to content

Commit 555be67

Browse files
committed
Readme update, old tabbed indents replaced with spaces
1 parent 99ca7b6 commit 555be67

40 files changed

+1328
-1312
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ This application covers:
152152
* Dynamic searching (Search as you type)
153153
* Caching
154154
* Elasticsearch integration
155+
* Google Vision API integration
155156
* ~~Better file uploads, such as [Dropify](http://jeremyfagis.github.io/dropify/)~~
156157

157158
##Changelog
@@ -160,7 +161,9 @@ This application covers:
160161

161162
* Got Gulp Switched with [sey](https://github.com/eserozvataf/sey), made by [Eser Özvataf](http://eser.ozvataf.com/). This way, assets building will be easier.
162163
* All dependencies' versions updated.
163-
* Minor code optimisations
164+
* Minor code optimisations.
165+
* All configuration values are now fetched from environment vars. Check `.env.example` file and find all variables prefixed with `WTT_`.
166+
* A new trait added for random methods, so it will run out of the box also with Postgres etc.
164167

165168
####0.2.2
166169

app/Http/Middleware/AdminMiddleware.php

+34-32
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,39 @@
33
use Closure;
44
use Illuminate\Contracts\Auth\Guard;
55

6-
class AdminMiddleware {
7-
8-
protected $auth;
9-
10-
public function __construct(Guard $auth) {
11-
$this->auth = $auth;
12-
}
13-
14-
/**
15-
* Handle an incoming request.
16-
*
17-
* @param \Illuminate\Http\Request $request
18-
* @param \Closure $next
19-
* @return mixed
20-
*/
21-
public function handle($request, Closure $next)
22-
{
23-
//We don't need to add a second middleware
24-
//this one can check whether the requester is a user, too
25-
if($this->auth->guest()){
26-
return response('Not authorized', 403);
27-
}
28-
29-
if($this->auth->user()->role != 'admin') {
30-
31-
$this->auth->logout();
32-
33-
return response('Not authorized', 403);
34-
}
35-
36-
return $next($request);
37-
}
6+
class AdminMiddleware
7+
{
8+
9+
protected $auth;
10+
11+
public function __construct(Guard $auth)
12+
{
13+
$this->auth = $auth;
14+
}
15+
16+
/**
17+
* Handle an incoming request.
18+
*
19+
* @param \Illuminate\Http\Request $request
20+
* @param \Closure $next
21+
* @return mixed
22+
*/
23+
public function handle($request, Closure $next)
24+
{
25+
//We don't need to add a second middleware
26+
//this one can check whether the requester is a user, too
27+
if ($this->auth->guest()) {
28+
return response('Not authorized', 403);
29+
}
30+
31+
if ($this->auth->user()->role != 'admin') {
32+
33+
$this->auth->logout();
34+
35+
return response('Not authorized', 403);
36+
}
37+
38+
return $next($request);
39+
}
3840

3941
}

app/Http/Middleware/Authenticate.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Authenticate
1717
/**
1818
* Create a new filter instance.
1919
*
20-
* @param Guard $auth
20+
* @param Guard $auth
2121
* @return void
2222
*/
2323
public function __construct(Guard $auth)
@@ -28,8 +28,8 @@ public function __construct(Guard $auth)
2828
/**
2929
* Handle an incoming request.
3030
*
31-
* @param \Illuminate\Http\Request $request
32-
* @param \Closure $next
31+
* @param \Illuminate\Http\Request $request
32+
* @param \Closure $next
3333
* @return mixed
3434
*/
3535
public function handle($request, Closure $next)

app/Http/Middleware/CheckSlugFirstParameterMiddleware.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
use Closure;
44

5-
class CheckSlugFirstParameterMiddleware {
5+
class CheckSlugFirstParameterMiddleware
6+
{
67

78
/**
89
* Handle an incoming request.
910
*
10-
* @param \Illuminate\Http\Request $request
11-
* @param \Closure $next
11+
* @param \Illuminate\Http\Request $request
12+
* @param \Closure $next
1213
* @return mixed
1314
*/
1415
public function handle($request, Closure $next)
1516
{
16-
17+
1718
$firstParam = $request->route()->parameters()['one'];
1819

19-
if(!preg_match("/^[0-9A-z-_]+$/", $firstParam)) {
20+
if (!preg_match("/^[0-9A-z-_]+$/", $firstParam)) {
2021
return response('Wrong input', 403);
2122
}
2223

app/Http/Middleware/RedirectIfAuthenticated.php

+32-32
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@
44
use Illuminate\Contracts\Auth\Guard;
55
use Illuminate\Http\RedirectResponse;
66

7-
class RedirectIfAuthenticated {
7+
class RedirectIfAuthenticated
8+
{
89

9-
/**
10-
* The Guard implementation.
11-
*
12-
* @var Guard
13-
*/
14-
protected $auth;
10+
/**
11+
* The Guard implementation.
12+
*
13+
* @var Guard
14+
*/
15+
protected $auth;
1516

16-
/**
17-
* Create a new filter instance.
18-
*
19-
* @param Guard $auth
20-
* @return void
21-
*/
22-
public function __construct(Guard $auth)
23-
{
24-
$this->auth = $auth;
25-
}
17+
/**
18+
* Create a new filter instance.
19+
*
20+
* @param Guard $auth
21+
* @return void
22+
*/
23+
public function __construct(Guard $auth)
24+
{
25+
$this->auth = $auth;
26+
}
2627

27-
/**
28-
* Handle an incoming request.
29-
*
30-
* @param \Illuminate\Http\Request $request
31-
* @param \Closure $next
32-
* @return mixed
33-
*/
34-
public function handle($request, Closure $next)
35-
{
36-
if ($this->auth->check())
37-
{
38-
return new RedirectResponse(url('/home'));
39-
}
28+
/**
29+
* Handle an incoming request.
30+
*
31+
* @param \Illuminate\Http\Request $request
32+
* @param \Closure $next
33+
* @return mixed
34+
*/
35+
public function handle($request, Closure $next)
36+
{
37+
if ($this->auth->check()) {
38+
return new RedirectResponse(url('/home'));
39+
}
4040

41-
return $next($request);
42-
}
41+
return $next($request);
42+
}
4343

4444
}

app/Http/Middleware/VerifyCsrfToken.php

+13-12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
use Closure;
44
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
55

6-
class VerifyCsrfToken extends BaseVerifier {
6+
class VerifyCsrfToken extends BaseVerifier
7+
{
78

8-
/**
9-
* Handle an incoming request.
10-
*
11-
* @param \Illuminate\Http\Request $request
12-
* @param \Closure $next
13-
* @return mixed
14-
*/
15-
public function handle($request, Closure $next)
16-
{
17-
return parent::handle($request, $next);
18-
}
9+
/**
10+
* Handle an incoming request.
11+
*
12+
* @param \Illuminate\Http\Request $request
13+
* @param \Closure $next
14+
* @return mixed
15+
*/
16+
public function handle($request, Closure $next)
17+
{
18+
return parent::handle($request, $next);
19+
}
1920

2021
}

app/Http/Requests/Request.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
use Illuminate\Foundation\Http\FormRequest;
44

5-
abstract class Request extends FormRequest {
6-
7-
//
8-
5+
abstract class Request extends FormRequest
6+
{
7+
//
98
}

app/Http/routes.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
Route::get('search', 'PhotoController@getSearch');
88

99
Route::controllers([
10-
'photo' => 'PhotoController',
11-
12-
'auth' => 'Auth\AuthController',
13-
'password' => 'Auth\PasswordController',
14-
15-
'admin/users' => 'Admin\UserController',
16-
'admin/photos' => 'Admin\PhotoController',
10+
'photo' => 'PhotoController',
11+
12+
'auth' => 'Auth\AuthController',
13+
'password' => 'Auth\PasswordController',
14+
15+
'admin/users' => 'Admin\UserController',
16+
'admin/photos' => 'Admin\PhotoController',
1717
]);

app/helpers.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

33
//gets file name (without extension) from a full path
4-
function getFileName($fullName) {
4+
function getFileName($fullName)
5+
{
56
$pathinfo = pathinfo($fullName);
67
return $pathinfo['filename'];
78
}

bootstrap/app.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
$app = new Illuminate\Foundation\Application(
15-
realpath(__DIR__.'/../')
15+
realpath(__DIR__ . '/../')
1616
);
1717

1818
/*
@@ -27,18 +27,18 @@
2727
*/
2828

2929
$app->singleton(
30-
'Illuminate\Contracts\Http\Kernel',
31-
'App\Http\Kernel'
30+
'Illuminate\Contracts\Http\Kernel',
31+
'App\Http\Kernel'
3232
);
3333

3434
$app->singleton(
35-
'Illuminate\Contracts\Console\Kernel',
36-
'App\Console\Kernel'
35+
'Illuminate\Contracts\Console\Kernel',
36+
'App\Console\Kernel'
3737
);
3838

3939
$app->singleton(
40-
'Illuminate\Contracts\Debug\ExceptionHandler',
41-
'App\Exceptions\Handler'
40+
'Illuminate\Contracts\Debug\ExceptionHandler',
41+
'App\Exceptions\Handler'
4242
);
4343

4444
/*

bootstrap/autoload.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
|
1515
*/
1616

17-
require __DIR__.'/../vendor/autoload.php';
17+
require __DIR__ . '/../vendor/autoload.php';
1818

1919
/*
2020
|--------------------------------------------------------------------------
@@ -27,9 +27,8 @@
2727
|
2828
*/
2929

30-
$compiledPath = __DIR__.'/cache/compiled.php';
30+
$compiledPath = __DIR__ . '/cache/compiled.php';
3131

32-
if (file_exists($compiledPath))
33-
{
34-
require $compiledPath;
32+
if (file_exists($compiledPath)) {
33+
require $compiledPath;
3534
}

0 commit comments

Comments
 (0)