当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Confer Session Storage

问题描述:

Very simple question that I can't find the answer for. I'm using Confer in my Laravel app and wish to alter the html that is stored in the session storage for each new message. I've made a few formatting changes to conversation messages in views\conversation.blade.php as well as views\confer.blade.php, but when a user submits a new message, that message is pushed with the original formatting. I can't for the life of me find where the html formatting is passed into the session so it can be pushed to the client.

Confer's SessionController.php

namespace DJB\Confer\Http\Controllers;

use App\Http\Controllers\Controller;

use App\Http\Requests;

use Illuminate\Http\Request;

use Session;

use Response;

class SessionController extends Controller {

/**

* Store the conversation list HTML in the session so that it can be retained over page loads

*

* @param Request $request

* @return Response

*/

public function store(Request $request)

{

Session::put('confer_conversations', $request->input('html'));

return Response::json(['success' => true]); // required to persist the session

}

/**

* Update the requested conversations that have yet to blossom with a message

*

* This needs to persist over page loads otherwise recipient(s) will not be

* subscribed to the channel to receive any messages.

*

* @param Request $request

* @return Response

*/

public function update(Request $request)

{

if (Session::has('confer_requested_conversations'))

{

Session::push('confer_requested_conversations', (int)$request->input('conversation_id'));

} else {

Session::put('confer_requested_conversations', [(int)$request->input('conversation_id')]);

}

return Response::json(['success' => true]); // required to persist the session

}

/**

* Clear the open chat list and requested list

*

* @return Response

*/

public function destroy()

{

Session::forget('confer_conversations');

Session::forget('confer_requested_conversations');

return redirect()->back();

}

}

MessageWasSent

namespace DJB\Confer\Commands;

use Illuminate\Console\Command;

use Illuminate\Queue\InteractsWithQueue;

use DJB\Confer\Message;

use DJB\Confer\Confer;

use Push;

class MessageWasSent extends Command {

use InteractsWithQueue;

protected $message;

protected $confer;

public function __construct(Message $message)

{

$this->message = $message;

$this->confer = new Confer();

}

/**

* Handle the command.

*/

public function handle()

{

$conversation = $this->message->conversation;

$conversation->touch();

if ($conversation->isGlobal())

{

Push::trigger($this->confer->global, 'NewMessageWasPosted', $this->message->getEventData('global'));

} else {

Push::trigger($this->message->conversation->getChannel(), 'NewMessageWasPosted', $this->message->getEventData());

Push::trigger($this->message->conversation->getChannel(), 'UserStoppedTyping', ['user' => $this->message->sender->id]);

}

}

}

namespace DJB\Confer\Events;

class MessageWasSent {

public function __construct()

{

}

public function handle()

{

}

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: