@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use WebDevEtc\BlogEtc\Models\Post; |
| 10 | 10 | |
| 11 | 11 | // Basic post factory, following happy path where everything is set up so posts can be seen. |
| 12 | -$factory->define(Post::class, static function (Faker $faker) { |
|
| 12 | +$factory->define(Post::class, static function(Faker $faker) { |
|
| 13 | 13 | return [ |
| 14 | 14 | 'title' => $faker->sentence, |
| 15 | 15 | 'slug' => $faker->uuid, |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | ]); |
| 31 | 31 | |
| 32 | 32 | // Post in future. |
| 33 | -$factory->state(Post::class, 'in_future', static function (Faker $faker) { |
|
| 33 | +$factory->state(Post::class, 'in_future', static function(Faker $faker) { |
|
| 34 | 34 | return [ |
| 35 | 35 | 'posted_at' => $faker->dateTimeBetween('now', '+2 years'), |
| 36 | 36 | ]; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | use Illuminate\Support\Str; |
| 9 | 9 | use WebDevEtc\BlogEtc\Models\Category; |
| 10 | 10 | |
| 11 | -$factory->define(Category::class, static function (Faker $faker) { |
|
| 11 | +$factory->define(Category::class, static function(Faker $faker) { |
|
| 12 | 12 | return [ |
| 13 | 13 | 'category_name' => $faker->sentence, |
| 14 | 14 | 'slug' => Str::slug($faker->sentence), |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::group(['middleware' => ['web'], 'namespace' => '\WebDevEtc\BlogEtc\Controllers'], static function () { |
|
| 3 | +Route::group(['middleware' => ['web'], 'namespace' => '\WebDevEtc\BlogEtc\Controllers'], static function() { |
|
| 4 | 4 | /* The main public facing blog routes - show all posts, view a category, rss feed, view a single post, also the add comment route */ |
| 5 | - Route::group(['prefix' => config('blogetc.blog_prefix', 'blog')], static function () { |
|
| 5 | + Route::group(['prefix' => config('blogetc.blog_prefix', 'blog')], static function() { |
|
| 6 | 6 | Route::get('/', 'BlogEtcReaderController@index') |
| 7 | 7 | ->name('blogetc.index'); |
| 8 | 8 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'BlogEtcReaderController@viewSinglePost') |
| 21 | 21 | ->name('blogetc.single'); |
| 22 | 22 | |
| 23 | - Route::group(['middleware' => 'throttle:10,3'], static function () { |
|
| 23 | + Route::group(['middleware' => 'throttle:10,3'], static function() { |
|
| 24 | 24 | Route::post('save_comment/{blogPostSlug}', |
| 25 | 25 | 'BlogEtcCommentWriterController@addNewComment') |
| 26 | 26 | ->name('blogetc.comments.add_new_comment'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | /* Admin backend routes - CRUD for posts, categories, and approving/deleting submitted comments */ |
| 31 | - Route::group(['prefix' => config('blogetc.admin_prefix', 'blog_admin')], static function () { |
|
| 31 | + Route::group(['prefix' => config('blogetc.admin_prefix', 'blog_admin')], static function() { |
|
| 32 | 32 | Route::get('/', 'BlogEtcAdminController@index') |
| 33 | 33 | ->name('blogetc.admin.index'); |
| 34 | 34 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'BlogEtcAdminController@update_post') |
| 49 | 49 | ->name('blogetc.admin.update_post'); |
| 50 | 50 | |
| 51 | - Route::group(['prefix' => 'image_uploads'], static function () { |
|
| 51 | + Route::group(['prefix' => 'image_uploads'], static function() { |
|
| 52 | 52 | Route::get('/', 'BlogEtcImageUploadController@index')->name('blogetc.admin.images.all'); |
| 53 | 53 | |
| 54 | 54 | Route::get('/upload', 'BlogEtcImageUploadController@create')->name('blogetc.admin.images.upload'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'BlogEtcAdminController@destroy_post') |
| 60 | 60 | ->name('blogetc.admin.destroy_post'); |
| 61 | 61 | |
| 62 | - Route::group(['prefix' => 'comments'], static function () { |
|
| 62 | + Route::group(['prefix' => 'comments'], static function() { |
|
| 63 | 63 | Route::get('/', |
| 64 | 64 | 'BlogEtcCommentsAdminController@index') |
| 65 | 65 | ->name('blogetc.admin.comments.index'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ->name('blogetc.admin.comments.delete'); |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | - Route::group(['prefix' => 'categories'], static function () { |
|
| 75 | + Route::group(['prefix' => 'categories'], static function() { |
|
| 76 | 76 | Route::get('/', |
| 77 | 77 | 'BlogEtcCategoryAdminController@index') |
| 78 | 78 | ->name('blogetc.admin.categories.index'); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function rules(): array |
| 37 | 37 | { |
| 38 | - $checkAnswer = static function ($attribute, $value, $fail) { |
|
| 38 | + $checkAnswer = static function($attribute, $value, $fail) { |
|
| 39 | 39 | $answers = config('blogetc.captcha.basic_answers'); |
| 40 | 40 | |
| 41 | 41 | $value = strtolower(trim($value)); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // However it will NOT delete the .jpg file on your file server. |
| 67 | 67 | // I recommend that you only change the enabled field before any images have been uploaded! |
| 68 | 68 | |
| 69 | - 'image_large' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
| 69 | + 'image_large' => [// this key must start with 'image_'. This is what the DB column must be named |
|
| 70 | 70 | // width in pixels |
| 71 | 71 | 'w' => 1000, |
| 72 | 72 | //height |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // if true then we will crop and resize to exactly w/h. If false then it will maintain proportions, with a max width of 'w' and max height of 'h' |
| 81 | 81 | 'crop' => true, |
| 82 | 82 | ], |
| 83 | - 'image_medium' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
| 83 | + 'image_medium' => [// this key must start with 'image_'. This is what the DB column must be named |
|
| 84 | 84 | // width in pixels |
| 85 | 85 | 'w' => 600, |
| 86 | 86 | //height |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | // if true then we will crop and resize to exactly w/h. If false then it will maintain proportions, with a max width of 'w' and max height of 'h'. If you use these images as part of your website template then you should probably have this to true. |
| 95 | 95 | 'crop' => true, |
| 96 | 96 | ], |
| 97 | - 'image_thumbnail' => [ // this key must start with 'image_'. This is what the DB column must be named |
|
| 97 | + 'image_thumbnail' => [// this key must start with 'image_'. This is what the DB column must be named |
|
| 98 | 98 | 'w' => 150, // width in pixels |
| 99 | 99 | 'h' => 150, //height |
| 100 | 100 | 'basic_key' => 'thumbnail', // same as the main key, but WITHOUT 'image_'. |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | 'rssfeed' => [ |
| 143 | 143 | 'should_shorten_text' => true, // boolean. Default: true. Should we shorten the text in rss feed? |
| 144 | 144 | 'text_limit' => 100, // max length of description text in the rss feed |
| 145 | - 'posts_to_show_in_rss_feed' => 10, // how many posts should we show in the rss feed |
|
| 145 | + 'posts_to_show_in_rss_feed' => 10, // how many posts should we show in the rss feed |
|
| 146 | 146 | 'cache_in_minutes' => 60, // how long (in minutes) to cache the RSS blog feed for. |
| 147 | 147 | 'description' => 'Our blog post RSS feed', //description for the RSS feed |
| 148 | 148 | 'language' => 'en', // see https://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | if (isset($image_size_details['crop']) && $image_size_details['crop']) { |
| 201 | 201 | $resizedImage = $resizedImage->fit($w, $h); |
| 202 | 202 | } else { |
| 203 | - $resizedImage = $resizedImage->resize($w, $h, function ($constraint) { |
|
| 203 | + $resizedImage = $resizedImage->resize($w, $h, function($constraint) { |
|
| 204 | 204 | $constraint->aspectRatio(); |
| 205 | 205 | }); |
| 206 | 206 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | if (isset($imageSizeDetails['crop']) && $imageSizeDetails['crop']) { |
| 411 | 411 | $resizedImage = $resizedImage->fit($w, $h); |
| 412 | 412 | } else { |
| 413 | - $resizedImage = $resizedImage->resize($w, $h, static function (Constraint $constraint) { |
|
| 413 | + $resizedImage = $resizedImage->resize($w, $h, static function(Constraint $constraint) { |
|
| 414 | 414 | $constraint->aspectRatio(); |
| 415 | 415 | }); |
| 416 | 416 | } |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | // } |
| 25 | 25 | // }; |
| 26 | 26 | |
| 27 | - $show_error_if_has_value = function ($attribute, $value, $fail) { |
|
| 27 | + $show_error_if_has_value = function($attribute, $value, $fail) { |
|
| 28 | 28 | if ($value) { |
| 29 | 29 | // return $fail if this had a value... |
| 30 | 30 | return $fail($attribute.' must be empty'); |
| 31 | 31 | } |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | - $disabled_use_view_file = function ($attribute, $value, $fail) { |
|
| 34 | + $disabled_use_view_file = function($attribute, $value, $fail) { |
|
| 35 | 35 | if ($value) { |
| 36 | 36 | // return $fail if this had a value |
| 37 | 37 | return $fail('The use of custom view files is not enabled for this site, so you cannot submit a value for it'); |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | 54 | |
| 55 | - $viewfile = resource_path('views/custom_blog_posts/' . $post->use_view_file . '.blade.php'); |
|
| 55 | + $viewfile = resource_path('views/custom_blog_posts/'.$post->use_view_file.'.blade.php'); |
|
| 56 | 56 | |
| 57 | 57 | ?> |
| 58 | 58 | <br> |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | <?php |
| 7 | 7 | $images_to_delete = []; |
| 8 | - foreach ((array)config('blogetc.image_sizes') as $image_size => $image_size_info) { |
|
| 8 | + foreach ((array) config('blogetc.image_sizes') as $image_size => $image_size_info) { |
|
| 9 | 9 | if (!$deletedPost->$image_size) { |
| 10 | 10 | continue; |
| 11 | 11 | } |