Skip to content

Commit cfb4cfe

Browse files
committed
compatible with laravel 6.x
1 parent c430f4d commit cfb4cfe

File tree

139 files changed

+4658
-6803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4658
-6803
lines changed

LICENSE.txt

100755100644
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2019 WebDevEtc.
3+
Copyright (c) 2018 WebDevEtc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

100755100644
+36-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
Package is in a rewrite (should be done by xmas 2019). Proper tests coming, unfortunately work has taken up a lot of my time since I first added this package, and I don't have time to get back to it and maintain it properly. The rewrite (which is just on the master branch...) has much better coding standards, proper unit/integration tests are intended to be added soon. The current versions on Packagist are on a different branch. I thought the rewrite would be a bit quicker!
1+
# August 2019 -
22

3-
Some older features will be stripped out. The next version will be a breaking change, but the code will be more maintainable. This package was originally (back in version 1) not really expecting to get any public use. The new version will handle more use cases easier.
3+
I am currently rewriting a lot of the code base (better quality, better coding standards, etc). Laravel 5.8 is supported on the old version (3.x) - please see packagist. I will release v4 soon.
44

55
# WebDevEtc BlogEtc
66
## Easy to install Laravel Package for adding a full blog (with admin backend) to your Laravel app
7-
8-
#### 5 minutes to install! Quick and easy!
9-
10-
[![StyleCI](https://github.styleci.io/repos/144829997/shield?branch=master)](https://github.styleci.io/repos/144829997)
11-
[![Build Status](https://travis-ci.org/WebDevEtc/BlogEtc.svg?branch=master)](https://travis-ci.org/WebDevEtc/BlogEtc)
7+
### 5 minutes to install! Quick and easy!
128

139
## Introduction
1410

1511
This is [WebDevEtc's](https://webdevetc.com/) BlogEtc package. It has everything you need to quickly and easily add a blog to your laravel app.
1612

17-
#### For the full installation guide please visit [the Laravel Blog Etc install guide here](https://webdevetc.com/laravel/packages/blogetc-blog-system-for-your-laravel-app/help-documentation/laravel-blog-package-blogetc#install_guide)
13+
14+
## FOR 5 MINUTE INSTALLATION GUIDE (with video guide), PLEASE VISIT [THE INSTALL GUIDE HERE](https://webdevetc.com/laravel/packages/blogetc-blog-system-for-your-laravel-app/help-documentation/laravel-blog-package-blogetc#install_guide)
15+
16+
[Install guide](https://webdevetc.com/laravel/packages/blogetc-blog-system-for-your-laravel-app/help-documentation/laravel-blog-package-blogetc#install_guide)[Packagist](https://packagist.org/packages/webdevetc/blogetc) << MAKE SURE YOU FOLLOW THE INSTURCTIONS. They're simple, but must be followed.
1817

1918
## Features
2019

@@ -79,6 +78,8 @@ This is [WebDevEtc's](https://webdevetc.com/) BlogEtc package. It has everything
7978

8079
2) if `use_custom_view_files` is enabled in the config (which it is by default), it means that any post with a custom view file set (details in the docs) can include any file within `/resources/views/custom_blog_posts`, which blade will execute. This package gives no method to edit any file within that directory though.
8180

81+
82+
8283
## How to install BlogEtc to your laravel app
8384

8485
Please see our [BlogEtc Laravel Blog Package Documentation/install guide](https://webdevetc.com/laravel/packages/blogetc-blog-system-for-your-laravel-app/help-documentation/laravel-blog-package-blogetc#install_guide) for install instructions. (It is very simple - done via composer/artisan commands, plus adding one method to your \App\User model (`canManageBlogEtcPosts()` which should return `true` if this user can manage the blog).
@@ -112,6 +113,27 @@ There is a built in captcha (anti spam comment) system built in, which will be e
112113

113114
Please see [our Captcha docs](https://webdevetc.com/laravel/packages/blogetc-blog-system-for-your-laravel-app/help-documentation/laravel-blog-package-blogetc#captcha) for more details.
114115

116+
## TODO
117+
118+
This is a list of features or things that I want to eventually get round to adding
119+
120+
- Better UI for uploading images/viewing uploaded images
121+
- Link uploaded images to blog post. At the moment they are not related.
122+
- Allow users to remove a featured image from a blog post.
123+
- Option to use HTMLPurifier to sanatise output.
124+
- Better options for assigning post authors (currently it just assigns the currently logged in user). However, if site has 10,000+ users do we really want an UI interface for this? The alternative is to add something like a a is_admin field to the `users` table and only show admin users.
125+
- Possibly add tags (we already have categories) but I am not sure how useful they really are, given that we already have categories.
126+
- Pagination for comments on view single post? At the moment we limit it to a high number (default in config is 5000).
127+
- RSS feed: shows from full (stripped tags) ->html of blog post (although has a setTextLimit() on it) - need to trim this, and if it uses custom view files then it should render that (without html).
128+
- Email notification to admin when new comment is added
129+
- RSS to use generate_introduction() for its contents.
130+
131+
132+
## Recent changes:
133+
134+
1) Added full text search and search views. You have to enable it in the config file (see latest config file)
135+
2) Need more than the 3 default image sizes? Add more in the config/blogetc.php file, add the database column for it and it'll work!
136+
115137
## Having problems, something is not working?
116138

117139
*Image upload errors?*
@@ -123,18 +145,21 @@ Try adding this to config/app.php:
123145
- Also make sure that /tmp is writable. If you have open_basedir enabled, be sure to add :/tmp to its value.
124146
- Ensure that /public/blog_images (or whatever directory you set it to in the config) is writable by the server
125147
- You might need to set a higher memory limit, or upload smaller image files. This will depend on your server. I've used it to upload huge (10mb+) jpg images without problem, once the server was set up correctly to handle larger file uploads.
126-
- New version of BlogEtc uses the Laravel filesystem to store images. You will probably need to run `php artisan storage:link` to use the images locally. If you are using something such as S3 then you will probably need to change the urls in blade.
148+
149+
150+
127151

128152
## Version History
129153

130-
- 4.x - Currently work in progress. Will be released end of 2019. For Laravel 6 onwards.
154+
155+
131156
- 3.1 - minor fixes
132157
- 3.0.3 - fixed RSS feed cache issue
133158
- 3.0.2 - fixed default medium image size (changed to 600x400)
134159
- 3.0.1 - replaced all short tags (<?) with full opening ones (<?php)
135160
- 3.0 - Added separate functionality for uploading images (and save some meta data in db)
136161
- 2.1 - added 'short_description' to db + form, and BlogEtcPost::generate_introduction() method will try and use this to generate intro text.
137-
- 2.0 - added full text search (enable it via the config file - it is disabled by default). (removed in future version, will be added again via a different package)
162+
- 2.0 - added full text search (enable it via the config file - it is disabled by default).
138163
- 1.2 - added WYSIWYG, few smaller changes
139164
- 1.1.1 - added basic captcha
140165
- 1.0.5 - composer.json changes.
@@ -147,13 +172,6 @@ Try adding this to config/app.php:
147172

148173
Please contact me on the contact from on [WebDev Etc](https://webdevetc.com/) or on [twitter](https://twitter.com/web_dev_etc/) and I'll get back to you asap.
149174

150-
## Upgrading to v6
151-
152-
A lot of the code base was changed for the next version of BlogEtc. I highly recommend you test locally.
153175

154-
Here is what you need to know:
155176

156-
1) Image uploads are now handled by the Laravel filesystem disks. You can use this to upload to services such as S3. By default it will use the 'public' disk, which will require you to run `php artisan storage:link` to create a symblink. Existing images will need to be moved to /storage/app/public/blog_images, and urls will need to be updated (to http://yoursite.com/storage/blog_images/*.jpg). You could also create a symblink to just link /storage/app/public/blog_images to http://yoursite/blog_images.
157-
2) Many of the internal files have been changed. Most files follow a proper coding style. This should not affect you.
158-
3) The search feature has been removed (it will get added again in the future).
159177

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"cviebrock/eloquent-sluggable": "4.5.*|4.6.*|4.7.*|4.8.*|6.0.*",
3434
"laravelium/feed": "~2.12.0|~3.0.0|3.1.*|v6.0.*",
3535
"intervention/image": "2.*",
36-
"swisnl/laravel-fulltext": "^0.18.0"
36+
"swisnl/laravel-fulltext": "^0.18.0",
37+
"laravel/helpers": "^1.2"
3738
},
3839
"require-dev": {
3940
"phpunit/phpunit": "*",

migrations/2018_05_28_224023_create_blog_etc_posts_table.php

100644100755
+36-41
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
<?php
22

3-
use Illuminate\Database\Migrations\Migration;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
66

7-
/**
8-
* Class CreateBlogEtcPostsTable.
9-
*/
107
class CreateBlogEtcPostsTable extends Migration
118
{
129
/**
13-
* Initial DB table setup for blog etc package.
10+
* Run the migrations.
1411
*
1512
* @return void
1613
*/
17-
public function up(): void
14+
public function up()
1815
{
19-
Schema::create('blog_etc_posts', static function (Blueprint $table) {
16+
Schema::create('blog_etc_posts', function (Blueprint $table) {
2017
$table->increments('id');
21-
$table->unsignedInteger('user_id')->index()->nullable();
22-
$table->string('slug')->unique();
18+
$table->unsignedInteger("user_id")->index()->nullable();
19+
$table->string("slug")->unique();
2320

24-
$table->string('title')->nullable()->default('New blog post');
25-
$table->string('subtitle')->nullable()->default('');
26-
$table->text('meta_desc')->nullable();
27-
$table->mediumText('post_body')->nullable();
21+
$table->string("title")->nullable()->default("New blog post");
22+
$table->string("subtitle")->nullable()->default("");
23+
$table->text("meta_desc")->nullable();
24+
$table->mediumText("post_body")->nullable();
2825

29-
$table->string('use_view_file')
30-
->nullable()
31-
->comment('If not null, this should refer to a blade file in /views/');
26+
$table->string("use_view_file")->nullable()->comment("should refer to a blade file in /views/");
3227

33-
$table->dateTime('posted_at')->index()->nullable()
34-
->comment('Public posted at time, if this is in future then it wont appear yet');
35-
$table->boolean('is_published')->default(true);
28+
$table->dateTime("posted_at")->index()->nullable()->comment("Public posted at time, if this is in future then it wont appear yet");
29+
$table->boolean("is_published")->default(true);
3630

3731
$table->string('image_large')->nullable();
3832
$table->string('image_medium')->nullable();
@@ -41,55 +35,56 @@ public function up(): void
4135
$table->timestamps();
4236
});
4337

44-
Schema::create('blog_etc_categories', static function (Blueprint $table) {
38+
Schema::create('blog_etc_categories', function (Blueprint $table) {
4539
$table->increments('id');
4640

47-
$table->string('category_name')->nullable();
48-
$table->string('slug')->unique();
49-
$table->mediumText('category_description')->nullable();
41+
$table->string("category_name")->nullable();
42+
$table->string("slug")->unique();
43+
$table->mediumText("category_description")->nullable();
5044

51-
$table->unsignedInteger('created_by')->nullable()->index()->comment('user id');
45+
$table->unsignedInteger("created_by")->nullable()->index()->comment("user id");
5246

5347
$table->timestamps();
5448
});
5549

56-
// linking table:
57-
Schema::create('blog_etc_post_categories', static function (Blueprint $table) {
50+
Schema::create('blog_etc_post_categories', function (Blueprint $table) {
5851
$table->increments('id');
5952

60-
$table->unsignedInteger('blog_etc_post_id')->index();
61-
$table->foreign('blog_etc_post_id')->references('id')->on('blog_etc_posts')->onDelete('cascade');
53+
$table->unsignedInteger("blog_etc_post_id")->index();
54+
$table->foreign('blog_etc_post_id')->references('id')->on('blog_etc_posts')->onDelete("cascade");
6255

63-
$table->unsignedInteger('blog_etc_category_id')->index();
64-
$table->foreign('blog_etc_category_id')->references('id')->on('blog_etc_categories')->onDelete('cascade');
56+
$table->unsignedInteger("blog_etc_category_id")->index();
57+
$table->foreign('blog_etc_category_id')->references('id')->on('blog_etc_categories')->onDelete("cascade");
6558
});
6659

67-
Schema::create('blog_etc_comments', static function (Blueprint $table) {
60+
61+
Schema::create('blog_etc_comments', function (Blueprint $table) {
6862
$table->increments('id');
6963

70-
$table->unsignedInteger('blog_etc_post_id')->index();
71-
$table->foreign('blog_etc_post_id')->references('id')->on('blog_etc_posts')->onDelete('cascade');
72-
$table->unsignedInteger('user_id')->nullable()->index()->comment('if user was logged in');
64+
$table->unsignedInteger("blog_etc_post_id")->index();
65+
$table->foreign('blog_etc_post_id')->references('id')->on('blog_etc_posts')->onDelete("cascade");
66+
$table->unsignedInteger("user_id")->nullable()->index()->comment("if user was logged in");
7367

74-
$table->string('ip')->nullable()->comment('if enabled in the config file');
75-
$table->string('author_name')->nullable()->comment('if not logged in');
68+
$table->string("ip")->nullable()->comment("if enabled in the config file");
69+
$table->string("author_name")->nullable()->comment("if not logged in");
7670

77-
$table->text('comment')->comment('the comment body');
71+
$table->text("comment")->comment("the comment body");
7872

79-
$table->boolean('approved')->default(true);
73+
$table->boolean("approved")->default(true);
8074

8175
$table->timestamps();
8276
});
77+
78+
8379
}
8480

8581
/**
8682
* Reverse the migrations.
8783
*
8884
* @return void
8985
*/
90-
public function down(): void
86+
public function down()
9187
{
92-
Schema::dropIfExists('blog_etc_comments');
9388
Schema::dropIfExists('blog_etc_post_categories');
9489
Schema::dropIfExists('blog_etc_categories');
9590
Schema::dropIfExists('blog_etc_posts');
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
<?php
22

3-
use Illuminate\Database\Migrations\Migration;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
66

7-
/**
8-
* Class AddAuthorAndUrlBlogEtcPostsTable.
9-
*/
107
class AddAuthorAndUrlBlogEtcPostsTable extends Migration
118
{
129
/**
13-
* Add author_email and author_website columns to Blog Etc comments table.
10+
* Run the migrations.
1411
*
1512
* @return void
1613
*/
17-
public function up(): void
14+
public function up()
1815
{
19-
Schema::table('blog_etc_comments', static function (Blueprint $table) {
20-
$table->string('author_email')->nullable();
21-
$table->string('author_website')->nullable();
16+
Schema::table('blog_etc_comments', function (Blueprint $table) {
17+
$table->string("author_email")->nullable();
18+
$table->string("author_website")->nullable();
2219
});
20+
2321
}
2422

2523
/**
2624
* Reverse the migrations.
2725
*
2826
* @return void
2927
*/
30-
public function down(): void
28+
public function down()
3129
{
32-
Schema::table('blog_etc_comments', static function (Blueprint $table) {
33-
$table->dropColumn('author_email');
34-
$table->dropColumn('author_website');
30+
31+
Schema::table('blog_etc_comments', function (Blueprint $table) {
32+
$table->dropColumn("author_email");
33+
$table->dropColumn("author_website");
3534
});
3635
}
3736
}
37+
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
<?php
22

3-
use Illuminate\Database\Migrations\Migration;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
66

7-
// (ignore typo! Don't want to change in case it breaks some people's migrations!)
8-
9-
/**
10-
* Class AddShortDescTextreaToBlogEtc.
11-
*/
127
class AddShortDescTextreaToBlogEtc extends Migration
138
{
149
/**
15-
* Create the DB table changes to add TEXT short_description column.
10+
* Run the migrations.
1611
*
1712
* @return void
1813
*/
19-
public function up(): void
14+
public function up()
2015
{
21-
Schema::table('blog_etc_posts', static function (Blueprint $table) {
22-
$table->text('short_description')->nullable();
16+
Schema::table('blog_etc_posts', function (Blueprint $table) {
17+
$table->text("short_description")->nullable();
2318
});
19+
2420
}
2521

2622
/**
2723
* Reverse the migrations.
2824
*
2925
* @return void
3026
*/
31-
public function down(): void
27+
public function down()
3228
{
33-
Schema::table('blog_etc_posts', static function (Blueprint $table) {
34-
$table->dropColumn('short_description');
29+
30+
Schema::table('blog_etc_posts', function (Blueprint $table) {
31+
$table->dropColumn("short_description");
3532
});
3633
}
3734
}

0 commit comments

Comments
 (0)