skyraptor / chatter
Chatter - A Laravel Forum package.
Requires
- doctrine/dbal: ^2.6|^3.0
- graham-campbell/markdown: ^13.1
- illuminate/bus: ^6.0|^7.0|^8.0
- illuminate/cache: 6.0|^7.0|^8.0
- illuminate/http: ^6.0|^7.0|^8.0
- illuminate/mail: ^6.0|^7.0|^8.0
- illuminate/queue: ^6.0|^7.0|^8.0
- illuminate/routing: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- dev-master
- 0.7.0-alpha16
- 0.7.0-alpha15
- 0.7.0-alpha14
- 0.7.0-alpha13
- 0.7.0-alpha12
- 0.7.0-alpha11
- 0.7.0-alpha10
- 0.7.0-alpha9
- 0.7.0-alpha8
- 0.7.0-alpha7
- 0.7.0-alpha6
- 0.7.0-alpha5
- 0.7.0-alpha4
- 0.7.0-alpha3
- 0.7.0-alpha1
- 0.6.0-alpha4
- 0.6.0-alpha3
- 0.6.0-alpha2
- 0.6.0-alpha1
- 0.5.11
- 0.5.10
- 0.5.9
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.5.0-alpha1
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.1
- 0.3
- 0.2.23
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.18
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-develop
- dev-release/0.3
- dev-analysis-zOxVG4
This package is auto-updated.
Last update: 2024-10-29 05:40:20 UTC
README
Chatter - A Laravel Forum package
Installation
Quick Note: If this is a new project, make sure to install the default user authentication provided with Laravel. php artisan make:auth
-
Include the package in your project
composer require skyraptor/chatter
-
Publish the Vendor Assets files by running:
php artisan vendor:publish --provider="SkyRaptor\Chatter\Providers\ChatterServiceProvider"
-
Now that we have published a few new files to our application we need to reload them with the following command:
composer dump-autoload
-
Run Your migrations:
php artisan migrate
Quick tip: Make sure that you've created a database and added your database credentials in your
.env
file. -
Lastly, run the seed files to seed your database with a little data:
php artisan db:seed --class=SkyRaptor\Chatter\Seeders\ChatterTableSeeder
-
Inside of your master.blade.php file include a header and footer yield. Inside the head of your master or app.blade.php add the following:
@stack('css')
Then, right above the
</body>
tag of your master file add the following:@stack('js')
Now, visit your site.com/forums and you should see your new forum in front of you!
Upgrading
Make sure that your composer.json file is requiring the latest version of chatter:
"skyraptor/chatter": "0.2.*"
Then you'll run:
composer update
Next, you may want to re-publish the chatter assets, chatter config, and the chatter migrations by running the following:
php artisan vendor:publish --tag=chatter-resources --force
php artisan vendor:publish --tag=chatter-assets --force
Next to make sure you have the latest database schema run:
php artisan migrate
And you'll be up-to-date with the latest version :)
Customization
CUSTOM CSS
If you want to add additional style changes you can simply add another stylesheet at the end of your @stack('css')
statement in the head of your master file. In order to only load this file when a user is accessing your forums you can include your stylesheet in the packages template files or wrap it in the following if
statement:
@if(Route::is( route('chatter.*'))
<!-- LINK TO YOUR CUSTOM STYLESHEET -->
<link rel="stylesheet" href="/assets/css/forums.css" />
@endif
In addition to that you can also import the SCSS from the package directly into your own build.
SEO FRIENDLY PAGE TITLES
Since the forum uses your master layout file, you will need to include the necessary code in order to display an SEO friendly title for your page. The following code will need to be added to the <head>
of your master file:
@if( Request::is( config('chatter.url.home')) )
<title>Title for your forum homepage - Website Name</title>
@elseif( Request::is( config('chatter.url.home') . '/' . config('chatter.url.category') . '/*' ) && isset( $discussion ) )
<title>{{ $discussion->category->name }} - Website Name</title>
@elseif( Request::is( config('chatter.url.home') . '/*' ) && isset($discussion->title))
<title>{{ $discussion->title }} - Website Name</title>
@endif
OVERRIDING VIEWS
In order to override Chatter's built in views, simply create a chatter
folder in your vendor
views folder, i.e. ROOT/resources/views/vendor/chatter
. Then simply drop in the Chatter view files you would like to override.
Laravel Events for the forum
This package provides a number of events allowing you to respond to user actions as they happen:
Listening for Events
To register your listeners for these events, follow the Laravel documentation for registering events and listeners.
For example, to register a listener for the "before new discussion" event, add the following to your EventServiceProvider
:
protected $listen = [ \SkyRaptor\Chatter\Events\ChatterBeforeNewDiscussion::class => [ \App\Listeners\HandleNewDiscussion::class, ], ];
where App\Listeners\HandleNewDiscussion
is a class in your application which handles the event when it's fired.
You can access the object that triggered the event in your listener with
public function handle(ChatterAfterNewDiscussion $event) { // $event->discussion // $event->post }
and
public function handle(ChatterAfterNewResponse $event) { // $event->post }