@@ -35,6 +35,6 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct() |
| 37 | 37 | { |
| 38 | - $this->middleware('guest', ['except' => 'logout']); |
|
| 38 | + $this->middleware('guest', [ 'except' => 'logout' ]); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function boot() |
| 15 | 15 | { |
| 16 | 16 | // |
| 17 | - require_once app_path().'/Http/Helpers.php'; |
|
| 17 | + require_once app_path() . '/Http/Helpers.php'; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @param \Illuminate\Http\Request $request |
| 27 | 27 | * @param Closure $next |
| 28 | - * @param array $models |
|
| 29 | 28 | * @return mixed |
| 30 | 29 | */ |
| 31 | 30 | public function handle(Request $request, Closure $next) |
@@ -31,15 +31,15 @@ |
||
| 31 | 31 | public function handle(Request $request, Closure $next) |
| 32 | 32 | { |
| 33 | 33 | $intArgs = func_num_args(); |
| 34 | - for($a = 2; $a < $intArgs; $a++){ |
|
| 34 | + for ($a = 2; $a < $intArgs; $a++) { |
|
| 35 | 35 | |
| 36 | 36 | $model = func_get_arg($a); |
| 37 | - $modelWithNamespace = 'App\\'.$model; |
|
| 37 | + $modelWithNamespace = 'App\\' . $model; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - $array = ['other_tables' => |
|
| 40 | + $array = [ 'other_tables' => |
|
| 41 | 41 | [ |
| 42 | - $model => $modelWithNamespace::orderBy('id', 'desc')->get(['id', 'name', 'url', 'image_extension']) |
|
| 42 | + $model => $modelWithNamespace::orderBy('id', 'desc')->get([ 'id', 'name', 'url', 'image_extension' ]) |
|
| 43 | 43 | ] |
| 44 | 44 | ]; |
| 45 | 45 | |
@@ -41,29 +41,29 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 44 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * The attributes that are mass assignable. |
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $fillable = ['name', 'email', 'password', 'age', 'blacklisted', 'ip', 'activation_code', 'active', |
|
| 52 | - 'fname', 'sname', 'bno', 'city', 'citypart', 'street', 'hno', 'zip', 'registration_data', 'phone']; |
|
| 51 | + protected $fillable = [ 'name', 'email', 'password', 'age', 'blacklisted', 'ip', 'activation_code', 'active', |
|
| 52 | + 'fname', 'sname', 'bno', 'city', 'citypart', 'street', 'hno', 'zip', 'registration_data', 'phone' ]; |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * The attributes excluded from the model's JSON form. |
| 56 | 56 | * |
| 57 | 57 | * @var array |
| 58 | 58 | */ |
| 59 | - protected $hidden = ['password', 'remember_token']; |
|
| 59 | + protected $hidden = [ 'password', 'remember_token' ]; |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Columns to exclude from index |
| 63 | 63 | * |
| 64 | 64 | * @var array |
| 65 | 65 | */ |
| 66 | - protected $excludedFromIndex = ['password']; |
|
| 66 | + protected $excludedFromIndex = [ 'password' ]; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Fields to search in fulltext mode |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return object |
| 100 | 100 | */ |
| 101 | - public function articles(){ |
|
| 101 | + public function articles() { |
|
| 102 | 102 | |
| 103 | 103 | return $this->hasMany('App\Article', 'user_id'); |
| 104 | 104 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return object |
| 110 | 110 | */ |
| 111 | - public function usergroups(){ |
|
| 111 | + public function usergroups() { |
|
| 112 | 112 | |
| 113 | 113 | return $this->belongsTo('App\Usergroup', 'usergroup_id'); |
| 114 | 114 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @param query $query |
| 120 | 120 | * @return query |
| 121 | 121 | */ |
| 122 | - public function scopeRelationships($query){ |
|
| 122 | + public function scopeRelationships($query) { |
|
| 123 | 123 | |
| 124 | 124 | return $query->with('usergroups'); |
| 125 | 125 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 36 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * The attributes that are mass assignable. |
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - protected $fillable = ['name']; |
|
| 43 | + protected $fillable = [ 'name' ]; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Fields to search in fulltext mode |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return object |
| 72 | 72 | */ |
| 73 | - public function users(){ |
|
| 73 | + public function users() { |
|
| 74 | 74 | |
| 75 | 75 | return $this->hasMany('App\User', 'usergroup_id'); |
| 76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param query $query |
| 82 | 82 | * @return query |
| 83 | 83 | */ |
| 84 | - public function scopeRelationships($query){ |
|
| 84 | + public function scopeRelationships($query) { |
|
| 85 | 85 | |
| 86 | 86 | return $query->with('users'); |
| 87 | 87 | } |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace App\Http\Controllers\Admin; |
| 16 | 16 | |
| 17 | -use App\Helpers; |
|
| 18 | 17 | use Illuminate\Http\Request; |
| 19 | 18 | use Illuminate\Support\Facades\Validator; |
| 20 | 19 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function __construct() { |
| 28 | 28 | parent::__construct(); |
| 29 | 29 | |
| 30 | - $this->middleware('add.lookup.tables:ImageCategory', ['only' => ['index','create','edit']]); |
|
| 30 | + $this->middleware('add.lookup.tables:ImageCategory', [ 'only' => [ 'index', 'create', 'edit' ] ]); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - protected $binaryFields = []; |
|
| 48 | + protected $binaryFields = [ ]; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Get number of pagination rows |
| 52 | 52 | * |
| 53 | 53 | * @return integer |
| 54 | 54 | */ |
| 55 | - public function getRowsToPaginate(){ |
|
| 55 | + public function getRowsToPaginate() { |
|
| 56 | 56 | |
| 57 | 57 | return env('ADMIN_MEDIA_PAGINATE', 12); |
| 58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param object $object |
| 64 | 64 | * @param Request $request |
| 65 | 65 | */ |
| 66 | - public function associateRelationships($object, Request $request){ |
|
| 66 | + public function associateRelationships($object, Request $request) { |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Validate category ID, if failed set to default |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * Validator OK - save it |
| 85 | 85 | */ |
| 86 | - else{ |
|
| 86 | + else { |
|
| 87 | 87 | |
| 88 | 88 | $object->imagecategories()->associate($request->input('imagecategory_id')); |
| 89 | 89 | } |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Image has an url |
| 109 | 109 | */ |
| 110 | - if(strlen($request->input('url') > 5)){ |
|
| 110 | + if (strlen($request->input('url') > 5)) { |
|
| 111 | 111 | $object->addMedia($request->file('image'))->toMediaCollection('images') |
| 112 | 112 | ->usingName($request->input('url')); |
| 113 | 113 | } |
| 114 | - else{ |
|
| 114 | + else { |
|
| 115 | 115 | $object->addMedia($request->file('image'))->toMediaCollection('images'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -110,8 +110,7 @@ |
||
| 110 | 110 | if(strlen($request->input('url') > 5)){ |
| 111 | 111 | $object->addMedia($request->file('image'))->toMediaCollection('images') |
| 112 | 112 | ->usingName($request->input('url')); |
| 113 | - } |
|
| 114 | - else{ |
|
| 113 | + } else{ |
|
| 115 | 114 | $object->addMedia($request->file('image'))->toMediaCollection('images'); |
| 116 | 115 | } |
| 117 | 116 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * Get image from storage |
| 33 | 33 | * |
| 34 | 34 | * @param Request $request |
| 35 | - * @return file |
|
| 35 | + * @return \Symfony\Component\HttpFoundation\StreamedResponse |
|
| 36 | 36 | */ |
| 37 | 37 | public function getImage(Request $request) |
| 38 | 38 | { |
@@ -14,14 +14,11 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace App\Http\Controllers\Media; |
| 16 | 16 | |
| 17 | -use App\Helpers; |
|
| 18 | 17 | use Illuminate\Http\Request; |
| 19 | - |
|
| 20 | 18 | use App\Http\Controllers\Controller; |
| 21 | 19 | use App\Image; |
| 22 | 20 | use Illuminate\Support\Facades\Response; |
| 23 | 21 | use Illuminate\Support\Facades\App; |
| 24 | -use Illuminate\Support\Facades\Cache; |
|
| 25 | 22 | use Illuminate\Support\Facades\Storage; |
| 26 | 23 | use Carbon\Carbon; |
| 27 | 24 | |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Get META information |
| 42 | 42 | */ |
| 43 | - $imageMeta = Image::where(['url' => $request->imageName])->first(); |
|
| 43 | + $imageMeta = Image::where([ 'url' => $request->imageName ])->first(); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * File does not exist |
| 47 | 47 | */ |
| 48 | - if(empty($imageMeta) == TRUE){ |
|
| 48 | + if (empty($imageMeta) == TRUE) { |
|
| 49 | 49 | App::abort(404); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $mediaItems = $imageMeta->getMedia(); |
| 53 | - $fullPathOnDisk = $mediaItems[0]->getPath(); |
|
| 53 | + $fullPathOnDisk = $mediaItems[ 0 ]->getPath(); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | 'Content-Description' => 'File Transfer', |
| 67 | 67 | 'Content-Transfer-Encoding' => 'binary', |
| 68 | 68 | 'Pragma' => 'public', |
| 69 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
| 69 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
| 70 | 70 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String() |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * Response code cached |
| 75 | 75 | */ |
| 76 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
| 77 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
| 76 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
| 77 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
| 78 | 78 | |
| 79 | 79 | $responseCode = 304; |
| 80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Response code not cached, but OK |
| 84 | 84 | */ |
| 85 | - else{ |
|
| 85 | + else { |
|
| 86 | 86 | |
| 87 | 87 | $responseCode = 200; |
| 88 | 88 | } |
@@ -34,28 +34,28 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @var array |
| 36 | 36 | */ |
| 37 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 37 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * The attributes that are mass assignable. |
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $fillable = ['name', 'description', 'alt', 'url']; |
|
| 44 | + protected $fillable = [ 'name', 'description', 'alt', 'url' ]; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Columns to exclude from index |
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $excludedFromIndex = []; |
|
| 51 | + protected $excludedFromIndex = [ ]; |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Hidden from custom find |
| 55 | 55 | * |
| 56 | 56 | * @var arrat |
| 57 | 57 | */ |
| 58 | - protected $excludedFromFind = []; |
|
| 58 | + protected $excludedFromFind = [ ]; |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Fields to search in fulltext mode |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return object |
| 102 | 102 | */ |
| 103 | - public function imagecategories(){ |
|
| 103 | + public function imagecategories() { |
|
| 104 | 104 | |
| 105 | 105 | return $this->belongsTo('App\ImageCategory', 'imagecategory_id'); |
| 106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return object |
| 112 | 112 | */ |
| 113 | - public function slides(){ |
|
| 113 | + public function slides() { |
|
| 114 | 114 | |
| 115 | 115 | return $this->hasMany('App\Slide', 'image_id'); |
| 116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return object |
| 122 | 122 | */ |
| 123 | - public function articlecategories(){ |
|
| 123 | + public function articlecategories() { |
|
| 124 | 124 | |
| 125 | 125 | return $this->hasMany('App\ArticleCategory', 'image_id'); |
| 126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return object |
| 132 | 132 | */ |
| 133 | - public function pages(){ |
|
| 133 | + public function pages() { |
|
| 134 | 134 | |
| 135 | 135 | return $this->hasMany('App\Page', 'image_id'); |
| 136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param query $query |
| 142 | 142 | * @return query |
| 143 | 143 | */ |
| 144 | - public function scopeRelationships($query){ |
|
| 144 | + public function scopeRelationships($query) { |
|
| 145 | 145 | |
| 146 | 146 | return $query->with('imagecategories'); |
| 147 | 147 | } |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @param array $array |
| 153 | 153 | */ |
| 154 | - public function hide($array = []){ |
|
| 154 | + public function hide($array = [ ]) { |
|
| 155 | 155 | |
| 156 | - $this->hidden = ['image']; |
|
| 156 | + $this->hidden = [ 'image' ]; |
|
| 157 | 157 | } |
| 158 | 158 | } |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Frontend root |
| 17 | 17 | */ |
| 18 | -Route::get('/', ['as' => 'root', function () { |
|
| 18 | +Route::get('/', [ 'as' => 'root', function() { |
|
| 19 | 19 | return view('welcome'); |
| 20 | -}]); |
|
| 20 | +} ]); |
|