Giter Site home page Giter Site logo

thedevdojo / chatter Goto Github PK

View Code? Open in Web Editor NEW
899.0 44.0 295.0 2.28 MB

Chatter is a Simple Laravel Forum Package

Home Page: https://devdojo.com/forums

License: MIT License

PHP 49.82% CSS 25.43% JavaScript 4.06% HTML 20.70%
chatter forum laravel-forum discussion

chatter's Introduction

Build Status Build Status Total Downloads Latest Stable Version License

Laravel Forum Package - Chatter

Installation

Quick Note: If this is a new project, make sure to install the default user authentication provided with Laravel. php artisan make:auth

  1. Include the package in your project

    composer require "devdojo/chatter=0.2.*"
    
  2. Add the service provider to your config/app.php providers array:

    If you're installing on Laravel 5.5+ skip this step

    DevDojo\Chatter\ChatterServiceProvider::class,
    
  3. Publish the Vendor Assets files by running:

    php artisan vendor:publish --provider="DevDojo\Chatter\ChatterServiceProvider"
    
  4. Now that we have published a few new files to our application we need to reload them with the following command:

    composer dump-autoload
    
  5. 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.

  6. Lastly, run the seed files to seed your database with a little data:

    php artisan db:seed --class=ChatterTableSeeder
    
  7. 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:

    @yield('css')
    

    Then, right above the </body> tag of your master file add the following:

    @yield('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:

"devdojo/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_assets --force
php artisan vendor:publish --tag=chatter_config --force
php artisan vendor:publish --tag=chatter_migrations --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 :)

Markdown editor

If you are going to make use of the markdown editor instead of tinymce you will need to change that in your config/chatter.php:

'editor' => 'simplemde',

In order to properly display the posts you will need to include the graham-campbell/markdown library for Laravel:

composer require graham-campbell/markdown

Trumbowyg editor

If you are going to use Trumbowyg as your editor of choice you will need to change that in your config/chatter.php:

'editor' => 'trumbowyg',

Trumbowyg requires jQuery >= 1.8 to be included.

VIDEOS

Introduction and Installation of Chatter

Configuration

When you published the vendor assets you added a new file inside of your config folder which is called config/chatter.php. This file contains a bunch of configuration you can use to configure your forums

Customization

CUSTOM CSS

If you want to add additional style changes you can simply add another stylesheet at the end of your @yield('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 following if statement:

@if(Request::is( Config::get('chatter.routes.home') ) || Request::is( Config::get('chatter.routes.home') . '/*' ))
    <!-- LINK TO YOUR CUSTOM STYLESHEET -->
    <link rel="stylesheet" href="/assets/css/forums.css" />
@endif

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::get('chatter.routes.home')) )
    <title>Title for your forum homepage -  Website Name</title>
@elseif( Request::is( Config::get('chatter.routes.home') . '/' . Config::get('chatter.routes.category') . '/*' ) && isset( $discussion ) )
    <title>{{ $discussion->category->name }} - Website Name</title>
@elseif( Request::is( Config::get('chatter.routes.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.

Custom Function Hooks for the forum

Sometimes you may want to add some additional functionality when a user creates a new discussion or adds a new response. Well, there are a few built in functions that you can create in your script to access this functionality:

Before User Adds New Discussion Create a new global function in your script called:

function chatter_before_new_discussion($request, $validator){}

Note: that the $request object is passed with the user input for each webhook. You can use it if you would like :) If not, no worries just add your custom functionality.

After User Adds New Discussion Create a new global function in your script called:

function chatter_after_new_discussion($request){}

Before User Adds New Response Create a new global function in your script called:

function chatter_before_new_response($request, $validator){}

After User Adds New Response Create a new global function in your script called:

function chatter_after_new_response($request){}

Laravel Events for the forum

This package provides a number of events allowing you to respond to user actions as they happen:

Event Available properties Description
ChatterBeforeNewDiscussion Illuminate\Http\Request ($request), Illuminate\Validation\Validator ($validator) This event is fired before a discussion is validated and created
ChatterAfterNewDiscussion Illuminate\Http\Request ($request), Models::discussion() ($discussion), Models::post() ($post) This event is fired after a discussion has been validated and created
ChatterBeforeNewResponse Illuminate\Http\Request ($request), Illuminate\Validation\Validator ($validator) This event is fired before a response is validated and created
ChatterAfterNewResponse Illuminate\Http\Request ($request), Models::post() ($post) This event is fired after a response is validated and created

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 = [
    'DevDojo\Chatter\Events\ChatterBeforeNewDiscussion' => [
        'App\Listeners\HandleNewDiscussion',
    ],
];

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
    }

Screenshots

chatter's People

Contributors

aaronranard avatar chrisbbreuer avatar cristianuibar avatar galdazbiz avatar gerbenjacobs avatar gggggggg avatar idbendriss avatar lucasleandro1204 avatar marktopper avatar mattlibera avatar mhanoglu avatar napestershine avatar putera avatar seanwhelan avatar steffen25 avatar thomasbs avatar timacdonald avatar tnylea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatter's Issues

SQLSTATE[HY000] on migration with sqlite

When I try to run migrations with sqlite I get this message:

[Illuminate\Database\QueryException]                                                                            
  SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (SQL: alter table "chat  
  ter_discussion" add column "slug" varchar not null) 

Seems abandoned

To be honest it seems like this package is abandoned for a long time, lots of PR and issues not even answered...

Move views to vendor directory

Hello,

Based on this issue, it would be nice if the ChatterServiceProvidercould copy the views into the resources/views/vendor directory. Then, customization would be easier to handle.

If you agree, I can make a PR.

[Suggest] use laravel localization

Hi,

I think it could be usefull for non english people to use langs resources instead of plain text, In this way, it will no longer be necessary to modify source code to change messages text.

Thanks,
Regards.

Wrong Route

When i used it i have some errors with routing so i edit some route in view to be more dynamic
in home view
@section(Config::get('chatter.yields.head')) <link href="{{url('public/vendor/devdojo/chatter/assets/vendor/spectrum/spectrum.css')}}" rel="stylesheet"> <link href="{{url('public/vendor/devdojo/chatter/assets/css/chatter.css')}}" rel="stylesheet"> @stop

Nothing to migrate.

Hey,

Thanks for the work on this package.

I was trying to integrate it with mine but after I do a php artisan vendor:publish I do not get any migrations from the package.

When I run php artisan migrate I get Nothing to migrate.

I am running Laravel 5.2.

Is it me doing something wrong? I am supposed to copy and paste the migrations manually?

Thanks!

JSON only views - using them?

Is anyone using the JSON only views? There are no links to them in the app, but they are there. Are they for an API or something? Should we be removing them?

Searchable Posts

Is it possible to utilise laravel scout to make forum posts searchable?

table errors

i followed your instructions word for word - but getting this error

SQLSTATE[HY000]: General error: 1 table chatter_discussion has no column named slug (SQL: insert into "chatter_discussion" ("title", "chatter_category_id", "user_id", "slug", "color", "updated_at", "created_at") values (Hello, 2, 1, hello, #b6d40d, 2016-09-19 11:20:27, 2016-09-19 11:20:27)

Integrate with Voyager?

Hello,

I'm just wondering if Chatter can be integrated with Voyager or is that still to come?

Thanks!

Subcategories Indent in Categories List

Right now, you can designate a "parent" category for categories, but there should be a visual indication of subcategories in the categories list. It's possible that the CSS for subcategories could simply add some margin or padding on the left, so they are indented from the list.

Great Forum

This is a great forum
However it really needs to be able to have the ability to edit the Main header / image so it becomes your own & plus i noticed you cant add Category unless you do this via Database which is a pain

CSS not showing

I am using laravel 5.3
My app.blade.php

`

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title> Open School </title>

<!-- Styles -->
@yield('css')
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" charset="utf-8">
<!-- Scripts -->
@include('partials.navigation') @yield('content') <script type="text/javascript" src="http://localhost/cdn/js/jquery.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

@yield('js')

![Uploading Capture.JPG…]() `

Problem with creating new discussion

I've installed chatter in laravel 5.3, at first i got error with Parse error: syntax error, unexpected ''Laravel'' so i commented out my app.blade.php at line 40
{{-- {{ config('app.name', add "Laravel") }} --}}
and everything went fine.

But after i tried to create new discussion i can't see any text like where to put title, categories etc.
I've followed the video tutorial but i got stuck in here while i trying to figure out what just happened.

ps: sorry for bad english.

screenshot_2016-10-25_11-49-35

documentation for single install

any documentation available for the forum to be installed not in another project? just a single install without any other app

Exception for any POSTrequest

When you try to send a post, edit or delete a message receive the same exception:

ErrorException in AuthManager.php line 292:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Auth\SessionGuard' does not have a method 'handle'

Laravel 5.2 and for auth use Sentinel.

Discussion and Post not working in my chatter application

Hi i tried to install the chatter application in laravel 5.4, i got a error message when i create a new discussion and create the post. this is the error message. How can i fix it?

FatalThrowableError in ChatterBeforeNewDiscussion.php line 26:
Type error: Argument 2 passed to DevDojo\Chatter\Events\ChatterBeforeNewDiscussion::__construct() must be an instance of Illuminate\Support\Facades\Validator, instance of Illuminate\Validation\Validator given, called in /home/menan/www/fourm/vendor/devdojo/chatter/src/Controllers/ChatterDiscussionController.php on line 66

Views

What would be the best way to customize the views of chatter?

Would be nice if you have a short tipp for me

Best Regards
Max

Mobile Improvements

Is there anything on the roadmap that would improve the use of the forum on a mobile device? The creation and contributing to a discussion is a little clunky at the moment.

No search functionality

Will this be added in later releases?

I tried using Laravel Scout in 5.4 and it worked beautifully.

Unit test doesn't work

We have a problem with our unit tests, Laravel says "Cannot declare class Chatter, because the name is already in use in ../vendor/devdojo/chatter/src/Helpers/Chatter.php on line 3". The problem is that you include "/Helpers/Chatter.php"

My solution to fix this is to use "Facades". Now the developer can add this to the config/app.php
'Chatter' => DevDojo\Chatter\Helpers\Chatter::class,. And add a namespace to the helper class "Chatter".

With this fix unit tests works again.

*IMPORTANT* Implement the views and answered field in the Chatter_Discussion table and TinyMCE error

I want to be able to notify a user on when there is a comment in his discussion.

Also

When I input an image source in the TinyMCE editor, it shows the preview but after posting it doesn't display.

# WHEN I UPLOAD

1

# AFTER UPLOADING

2

# I CHECK CHROME CONSOLE
3

I EDIT IT FROM THE DISCUSSION

4

Please can you tell me what part of the code to edit to fix this... I can try to find it myself but i still have a lot to do in a short period of time.

Thanks Mate. Good Job.

Config not working as expected

I have installed chatter into my project however the config for user profile doesn't work.
If I have the config set to nothing, it still generates a link to /user

If I add something to the config, it takes no effect.

tinymce app/css error loading

capture d ecran 4

hi, i can't load vendor asset file app.css , it required by tinymce ,
i have ingrate js and css in app.layout and , but this plugin file is nested , any solution and thanks.

customise

How do i customise Chatter ? ie remove page header etc ?

Upgrading from version 0.1.22

When I upgraded from v0.1.22...

Normally when a user isnt logged in and tries to create a new disscussion they are redirected to the login page with ?redirect=Forums.

I have built my app around that so
Now it doesnt even do anything when the new discussion button is clicked.

is there a way around this.

Override Routes

I would like to override some of the routing in my application’s routes folder from this chatter's routes. How do I do that ?

Views not publishing

I followed the guide, and it's not publishing the views.

View [layouts.app] not found. (View: /Users/manshu/Documents/apps/thinkpmp/vendor/devdojo/chatter/src/Views/home.blade.php)

A few ideas :)

I was thinking about forking to achieve this, but i wanted your guys input.

I was thinking a few ways that this package could become the best/default forum package for laravel.

The ability to publish a few more things, for example the forum master layout so that you could customize it safely.
I think some way of having the routes defined in your routes file and defined in the chatter config could help for reasons explained in my next idea.

doing these things will mean quite allot in terms of people extending this forum safely, for example in a caffienated module. If you could publish the master layout, you could require a modified view into other views and make a view just for admins etc to moderate restricted by an outside model.

I think it could be done by simply publishing the master layout and then having the package config check for that first?

The reason i haven't forked is for i figure that the package creator/current code contributors/users are far better to put input on these things.

Any thoughts?

Integrity constraint violation: 1048 Column 'color'

integrityconstr
I push "create disscation" and vualia:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'color'
cannot be null (SQL: insert into chatter_discussion (title, chatter_category_id, user_id, slug, color, updated_at, created_at) values ({}fghgh, 3, 2, fghgh, , 2017-01-26 13:50:37, 2017-01-26 13:50:37))

FatalErrorException in Model.php line 779:

i have installed on live server i am getting this error on /forums url only

FatalErrorException in Model.php line 779:
Class 'App\User' not found
in Model.php line 779

New discussion category dropdown

I have noticed that on the new discussion popup, We have a big of a bug.
Edit - See comments below a temporary fix has been found

Until the package has been updated, you can fix this temporarily within your chatter by declaring the following CSS in your forum custom stylesheet

.col-md-7 .form-control {
    padding: 25px 20px;
}

.col-md-4 .form-control {
    padding: 0 !important;
}

Without this you cannot see the currently selected option in the dropdown.

Editing a post strips the content.

When you create new discussion/post you only strip the content for validation. And you insert the unstripped variable to the creation of the object.

But when you edit and save it. You strip it for both, the validation and also for the update.

This results in that the html tags are not working after you edit a post. Only when you create one.

Example
When you create the post with few line breaks...
screen shot 2017-03-17 at 14 37 07

And then you only click edit & save...
screen shot 2017-03-17 at 14 37 17

MarkdownServiceProvider not found on fresh install

FatalThrowableError in Application.php line 606:
Class 'GrahamCampbell\Markdown\MarkdownServiceProvider' not found

because in Chatter's controllers it gets registered:

The composer.json needs to be updated with:

{
    "require": {
        "graham-campbell/markdown": "^7.0"
    }
}

or I prefer checking what the current editor is before registering.

I will send in a PR later.

Fresh Install Error for Vendor Publish

I got this error when i do php artisan vendor publish

  [League\Flysystem\FileNotFoundException]
  File not found at path: 016_07_29_171118_create_chatter_categories_table.php

How to add more categories

Hi,
Thanks for your great package, I have installed the package and everything is well. How can I add more categories for forum discussions? Is there any simple way or we should add them manually to the database.

Thank's :)

Bug: when delete post to end ,but the discussion still exist

i add some codes in ChatterPostController.php destroy funtcion

if(!Auth::guest() && (Auth::user()->id == $post->user_id)){
            $post->delete();
            $count_post = Post::where('chatter_discussion_id',$post->chatter_discussion_id)->count(); /*added*/
            $discussion = Discussion::find($post->chatter_discussion_id);
            $chatter_alert = array(
                'chatter_alert_type' => 'success',
                'chatter_alert' => 'Successfully deleted response from the ' . config('chatter.titles.discussion') . '.'
                );
            if($count_post<=0){
                Discussion::find($post->chatter_discussion_id)->delete();
            }/*added*/
            return redirect('/' . config('chatter.routes.home') . '/' . config('chatter.routes.discussion') . '/' . $discussion->slug)->with($chatter_alert);

        }

XSS Vulnerability

Hi there, I found a XSS vulnerability using your package.

  1. Create a new discussion with a title and description.
  2. Edit the post content to
    <embed src="data:image/svg+xml;base64,PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHg9IjAiIHk9IjAiIHdpZHRoPSIxOTQiIGhlaWdodD0iMjAwIiBpZD0ieHNzIj48c2NyaXB0IHR5cGU9InRleHQvZWNtYXNjcmlwdCI+YWxlcnQoInN0ZWZmZW4yNSBYU1MiKTs8L3NjcmlwdD48L3N2Zz4=" type="image/svg+xml">
  3. Click the update response button
  4. Then once the post has been updated with the content above go to next step
  5. Click the edit button and then click the update response button again like the step 3.
  6. You can now see a popup box with the message "steffen25 XSS"
    You can do more nasty stuff this is just an example :)

I tried to capture it using Gyazo but I only had a few seconds to do it but here you go:
Preview

Name the forums route

In my application, i would rather call a route my the name.... cos i have some other functions that depend on having the route named. The "/forums" is not a named route.

Installation problem in Laravel 5.3

I am able to install successfully in laravel 5.3. However, after that, no CSS and JS are working although I copied css and js yield.

None of the link in example post are working.

jQuery as a requirement?

What do you guys think to make jQuery a requirement for maybe 0.3? Would make some Javascript development on my part a little easier and much cleaner and opens up some more options as well.

edit: sorry it seems like it already is a requirement.

Failed to load resource: app.css

jquery.tinymce.min.js throws this error if app.css is not located in css/app.css

app.css Failed to load resource: the server responded with a status of 404 (Not Found)

MarkdownServiceProvider not found

Hi,

We use chatter as our forum package. I was testing the new version on a clean laravel 5.4 installation and I get the following error. "Class 'GrahamCampbell\Markdown\MarkdownServiceProvider' not found". This is triggered by the ChatterController on line 27. I think you forget to add "graham-campbell/markdown" to the composer.json

Route not working with existing project

I installed Chatter into a fresh install just like the video and it worked like a charm. Confident, I then tried to install it into an existing project (5.3). Everything worked again without errors like the video except when I go to mysite/forums, my exisiting homepage reloads as if there is no /forums route.

Please suggest ways to debug since the forum is beautiful and very simple to administate.

Thanks,
Jon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.