1. Go to this page and download the library: Download spatie/laravel-help-space library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spatie / laravel-help-space example snippets
use Spatie\HelpSpace\Http\Requests\HelpSpaceRequest;
HelpSpace::sidebar(function(HelpSpaceRequest $request) {
$user = User::firstWhere('email', $request->email())
if (! $user) {
return 'No user found';
}
// any view of your own in which you render the html
// to be displayed at HelpSpace
return view('help-space.sidebar', compact('user'));
})
return [
/*
* The secret used to verify if the incoming HelpSpace secret is valid
*/
'secret' => env('HELP_SPACE_SECRET'),
/*
* The package will automatically register this route to handle incoming
* requests from HelpSpace.
*
* You can set this to `null` if you prefer to register your route manually.
*/
'url' => '/help-space',
/*
* These middleware will be applied on the automatically registered route.
*/
'middleware' => [
Spatie\HelpSpace\Http\Middleware\IsValidHelpSpaceRequest::class,
'api',
],
];
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Spatie\HelpSpace\Facades\HelpSpace;
use Spatie\HelpSpace\Http\Requests\HelpSpaceRequest;
class HelpSpaceServiceProvider extends ServiceProvider
{
public function register()
{
HelpSpace::sidebar(function(HelpSpaceRequest $request) {
return "HTML about {$request->email()}";
});
}
}