@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('fg_albums', function (Blueprint $table) { |
|
16 | + Schema::create('fg_albums', function(Blueprint $table) { |
|
17 | 17 | $table->string('id', 150)->primary(); |
18 | 18 | $table->string('ministry_id', 150)->index(); |
19 | 19 | $table->string('name'); |
@@ -47,6 +47,6 @@ |
||
47 | 47 | |
48 | 48 | public function getImageDimensions() |
49 | 49 | { |
50 | - return [0, 100]; |
|
50 | + return [ 0, 100 ]; |
|
51 | 51 | } |
52 | 52 | } |
@@ -34,10 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | public function handle(ImageManager $imageManager) |
36 | 36 | { |
37 | - $ogImage = storage_path('app/public/gallery/original/').$this->image->name; |
|
38 | - $thumb100 = storage_path('app/public/gallery/100-100/').$this->image->name; |
|
37 | + $ogImage = storage_path('app/public/gallery/original/') . $this->image->name; |
|
38 | + $thumb100 = storage_path('app/public/gallery/100-100/') . $this->image->name; |
|
39 | 39 | |
40 | - $imageManager->make($ogImage)->fit(100, 100, function ($constraint) { |
|
40 | + $imageManager->make($ogImage)->fit(100, 100, function($constraint) { |
|
41 | 41 | $constraint->upsize(); |
42 | 42 | $constraint->aspectRatio(); |
43 | 43 | }, 'center')->save($thumb100); |
@@ -19,21 +19,21 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function boot() |
21 | 21 | { |
22 | - $this->registerRoutes(__DIR__.'/../../routes/gallery.php', __DIR__.'/../../routes/source.php'); |
|
22 | + $this->registerRoutes(__DIR__ . '/../../routes/gallery.php', __DIR__ . '/../../routes/source.php'); |
|
23 | 23 | |
24 | - $this->setUpSourceFiles(function () { |
|
25 | - $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
24 | + $this->setUpSourceFiles(function() { |
|
25 | + $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
26 | 26 | $this->publishes([ |
27 | - __DIR__.'/../../storage/gallery/' => storage_path('app/public/gallery'), |
|
27 | + __DIR__ . '/../../storage/gallery/' => storage_path('app/public/gallery'), |
|
28 | 28 | ], 'faithgen-gallery-storage'); |
29 | 29 | |
30 | 30 | $this->publishes([ |
31 | - __DIR__.'/../../database/migrations/' => database_path('migrations'), |
|
31 | + __DIR__ . '/../../database/migrations/' => database_path('migrations'), |
|
32 | 32 | ], 'faithgen-gallery-migrations'); |
33 | 33 | }); |
34 | 34 | |
35 | 35 | $this->publishes([ |
36 | - __DIR__.'/../../config/faithgen-gallery.php' => config_path('faithgen-gallery.php'), |
|
36 | + __DIR__ . '/../../config/faithgen-gallery.php' => config_path('faithgen-gallery.php'), |
|
37 | 37 | ], 'faithgen-gallery-config'); |
38 | 38 | |
39 | 39 | Album::observe(AlbumObserver::class); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function register() |
48 | 48 | { |
49 | - $this->mergeConfigFrom(__DIR__.'/../../config/faithgen-gallery.php', 'faithgen-gallery'); |
|
49 | + $this->mergeConfigFrom(__DIR__ . '/../../config/faithgen-gallery.php', 'faithgen-gallery'); |
|
50 | 50 | |
51 | 51 | $this->app->singleton(AlbumService::class); |
52 | 52 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function create(Ministry $user) |
45 | 45 | { |
46 | - $albumsCount = Album::where('ministry_id', $user->id)->whereBetween('created_at', [Carbon::now()->firstOfMonth(), Carbon::now()->lastOfMonth()])->count(); |
|
46 | + $albumsCount = Album::where('ministry_id', $user->id)->whereBetween('created_at', [ Carbon::now()->firstOfMonth(), Carbon::now()->lastOfMonth() ])->count(); |
|
47 | 47 | |
48 | 48 | return $this->getAuthorization($user, $albumsCount, 'albums'); |
49 | 49 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } else { |
81 | 81 | return self::getAuthorization($ministry, $albumSize, 'images'); |
82 | 82 | $allow = self::getAuthorization($ministry, $albumSize, 'images'); |
83 | - if (! $allow) { |
|
83 | + if (!$allow) { |
|
84 | 84 | return false; |
85 | 85 | } else { |
86 | 86 | if ($ministry->account->level === 'Free') { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getUnsetFields() |
37 | 37 | { |
38 | - return ['album_id']; |
|
38 | + return [ 'album_id' ]; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function index(IndexRequest $request) |
48 | 48 | { |
49 | - $albums = $this->albumService->getParentRelationship()->where('name', 'LIKE', '%'.$request->filter_text.'%') |
|
49 | + $albums = $this->albumService->getParentRelationship()->where('name', 'LIKE', '%' . $request->filter_text . '%') |
|
50 | 50 | ->latest() |
51 | 51 | ->paginate($request->has('limit') ? $request->limit : 15); |
52 | 52 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function addImage(AddImagesRequest $request, ImageManager $imageManager) |
118 | 118 | { |
119 | - $fileName = str_shuffle($this->albumService->getAlbum()->id.time().time()).'.png'; |
|
120 | - $ogSave = storage_path('app/public/gallery/original/').$fileName; |
|
119 | + $fileName = str_shuffle($this->albumService->getAlbum()->id . time() . time()) . '.png'; |
|
120 | + $ogSave = storage_path('app/public/gallery/original/') . $fileName; |
|
121 | 121 | |
122 | 122 | $imageManager->make($request->file('images'))->save($ogSave); |
123 | 123 | |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | $image = $this->albumService->getAlbum()->images()->findOrFail($request->image_id); |
144 | 144 | |
145 | 145 | try { |
146 | - unlink(storage_path('app/public/gallery/100-100/'.$image->name)); |
|
147 | - unlink(storage_path('app/public/gallery/original/'.$image->name)); |
|
146 | + unlink(storage_path('app/public/gallery/100-100/' . $image->name)); |
|
147 | + unlink(storage_path('app/public/gallery/original/' . $image->name)); |
|
148 | 148 | $image->delete(); |
149 | 149 | |
150 | 150 | return $this->successResponse('Image deleted!'); |
@@ -6,10 +6,10 @@ |
||
6 | 6 | Route::name('albums.') |
7 | 7 | ->prefix('albums/') |
8 | 8 | ->middleware('source.site') |
9 | - ->group(function () { |
|
10 | - Route::post('/create', [AlbumController::class, 'create']); |
|
11 | - Route::post('/add-images', [AlbumController::class, 'addImage']); |
|
12 | - Route::put('/update', [AlbumController::class, 'update']); |
|
13 | - Route::delete('/delete', [AlbumController::class, 'destroy']); |
|
14 | - Route::delete('/delete-image', [AlbumController::class, 'destroyImage']); |
|
9 | + ->group(function() { |
|
10 | + Route::post('/create', [ AlbumController::class, 'create' ]); |
|
11 | + Route::post('/add-images', [ AlbumController::class, 'addImage' ]); |
|
12 | + Route::put('/update', [ AlbumController::class, 'update' ]); |
|
13 | + Route::delete('/delete', [ AlbumController::class, 'destroy' ]); |
|
14 | + Route::delete('/delete-image', [ AlbumController::class, 'destroyImage' ]); |
|
15 | 15 | }); |
@@ -3,9 +3,9 @@ |
||
3 | 3 | use FaithGen\Gallery\Http\Controllers\AlbumController; |
4 | 4 | use Illuminate\Support\Facades\Route; |
5 | 5 | |
6 | -Route::name('albums.')->prefix('albums/')->group(function () { |
|
7 | - Route::get('/', [AlbumController::class, 'index']); |
|
8 | - Route::get('/view', [AlbumController::class, 'view']); |
|
9 | - Route::get('comments/{album}', [AlbumController::class, 'comments']); |
|
10 | - Route::post('/comment', [AlbumController::class, 'comment']); |
|
6 | +Route::name('albums.')->prefix('albums/')->group(function() { |
|
7 | + Route::get('/', [ AlbumController::class, 'index' ]); |
|
8 | + Route::get('/view', [ AlbumController::class, 'view' ]); |
|
9 | + Route::get('comments/{album}', [ AlbumController::class, 'comments' ]); |
|
10 | + Route::post('/comment', [ AlbumController::class, 'comment' ]); |
|
11 | 11 | }); |