1. Go to this page and download the library: Download liveintent/laravel-common 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/ */
liveintent / laravel-common example snippets
use LiveIntent\LaravelCommon\LaravelCommon;
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
// ...
LaravelCommon::registerAuthGuard();
}
/**
* Persist a copy of the transient user in the database.
*/
public function persistFromTransient()
{
static::upsert(
[['id' => $this->id]],
['id'],
[],
);
}
protected $middleware = [
\LiveIntent\LaravelCommon\Http\Middleware\LogWithRequestContext::class,
// ... All other middleware
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use LiveIntent\LaravelCommon\LaravelCommon;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
LaravelCommon::logHttpRequests();
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use LiveIntent\LaravelCommon\LaravelCommon;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
LaravelCommon::healthChecks();
}
}
namespace Tests\Feature\Api\Notification;
use Tests\Feature\Api\ApiTestCase;
use App\Models\PendingNotification;
use LiveIntent\LaravelCommon\Testing\ActsAsUsers;
class DeleteNotificationTest extends ApiTestCase
{
use ActsAsUsers;
/** @test */
public function an_admin_user_can_delete_an_existing_notification()
{
$notification = PendingNotification::factory()->create();
$this->actingAsAdmin()
->deleteJson("/api/notifications/{$notification->id}")
->assertOk();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.