PHP code example of devianl2 / tenant-support

1. Go to this page and download the library: Download devianl2/tenant-support 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/ */

    

devianl2 / tenant-support example snippets

sh
php artisan vendor:publish --provider="Tenant\Auth\TenantSupportProvider"
sh
protected function configureRateLimiting()
    {
        RateLimiter::for('api', function (Request $request) {
            return Limit::perMinute(600)->by(optional($request->user())->id ?: $request->ip());
        });
    }
sh
public function successResponse($data, $statusCode = Response::HTTP_OK)
    {
        return response($data, $statusCode)->header('Content-Type', 'application/json');
    }
    public function errorResponse($errorMessage, $statusCode)
    {
        return response()->json(['error' => $errorMessage, 'error_code' => $statusCode], $statusCode);
    }
    public function errorMessage($errorMessage, $statusCode)
    {
        return response($errorMessage, $statusCode)->header('Content-Type', 'application/json');
    }
sh
$templates  =   QuestionTemplate::with([
            'sections'
        ]);

        if (array_key_exists('search', $query) && !empty($query['search']))
        {
            $templates =   $templates->where('title', 'LIKE', '%' . $query['search'] .'%');
        }

        return $this->execute($templates, $paginate, $limit);