-
-
Save BrightnBubbly/c4a5341d820044dc262c710afca87df9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use GetStream\StreamChat\Client as StreamClient; | |
use App\User; | |
use App\Channel; | |
use Illuminate\Support\Facades\Auth; | |
class ChatController extends Controller | |
{ | |
protected $client; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->client = new StreamClient( | |
getenv("STREAM_API_KEY"), | |
getenv("STREAM_API_SECRET"), | |
null, | |
null, | |
9 // timeout | |
); | |
} | |
/** | |
* Generate Token from Stream Chat | |
*/ | |
public function getnerateToken(Request $request) | |
{ | |
return response()->json([ | |
'token' => $this->client->createToken($request->input('username')) | |
], 200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment