PHP code example of bambolee-digital / event-user-manager
1. Go to this page and download the library: Download bambolee-digital/event-user-manager 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/ */
bambolee-digital / event-user-manager example snippets
use BamboleeDigital\EventUserManager\Filament\Resources\EventResource;
use BamboleeDigital\EventUserManager\Filament\Resources\EventTypeResource;
use BamboleeDigital\OnboardingPackage\Filament\Resources\QuestionResource;
->resources([
EventResource::class,
EventTypeResource::class,
RecurrencePatternResource::class,
])
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'http://your-api-base-url/',
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Accept' => 'application/json',
],
]);
$response = $client->get('api/events');
$events = json_decode($response->getBody(), true);
$multipart = [
['name' => 'name', 'contents' => 'Annual Company Retreat'],
['name' => 'description', 'contents' => 'Our yearly company-wide retreat for team building and strategy planning.'],
['name' => 'event_type_id', 'contents' => '1'],
['name' => 'start_date', 'contents' => '2024-07-15 09:00:00'],
['name' => 'end_date', 'contents' => '2024-07-17 17:00:00'],
['name' => 'status', 'contents' => 'active'],
['name' => 'recurrence_pattern_id', 'contents' => '2'],
['name' => 'frequency_type', 'contents' => 'yearly'],
['name' => 'frequency_count', 'contents' => '5'],
['name' => 'metadata[location]', 'contents' => 'Mountain Resort'],
['name' => 'metadata[expected_attendees]', 'contents' => '150'],
[
'name' => 'attachments[]',
'contents' => fopen('path/to/schedule.pdf', 'r'),
'filename' => 'retreat_schedule.pdf',
],
[
'name' => 'images[]',
'contents' => fopen('path/to/venue.jpg', 'r'),
'filename' => 'retreat_venue.jpg',
],
['name' => 'notes[0][content]', 'contents' => 'Remember to book flight tickets for overseas participants.'],
[
'name' => 'notes[0][attachments][]',
'contents' => fopen('path/to/flight_details.pdf', 'r'),
'filename' => 'flight_details.pdf',
],
];
$response = $client->post('api/events', [
'multipart' => $multipart,
]);
$eventData = json_decode($response->getBody(), true);
echo "Event created with ID: " . $eventData['id'];
$eventId = 1;
$response = $client->get("api/events/{$eventId}");
$event = json_decode($response->getBody(), true);
$eventId = 1;
$response = $client->put("api/events/{$eventId}", [
'json' => [
'name' => 'Updated Event Name',
'description' => 'This is an updated description',
'start_date' => '2024-08-01 10:00:00',
],
]);
$updatedEvent = json_decode($response->getBody(), true);
$eventId = 1;
$response = $client->delete("api/events/{$eventId}");
echo $response->getStatusCode() == 204 ? "Event deleted successfully" : "Failed to delete event";
$response = $client->get('api/events/past');
$pastEvents = json_decode($response->getBody(), true);
$response = $client->get('api/events/future');
$futureEvents = json_decode($response->getBody(), true);
$status = 'active';
$response = $client->get("api/events/status/{$status}");
$activeEvents = json_decode($response->getBody(), true);
$eventId = 1;
$response = $client->post("api/events/{$eventId}/notes", [
'json' => [
'content' => 'This is a new note for the event',
],
]);
$note = json_decode($response->getBody(), true);
$eventId = 1;
$noteId = 1;
$response = $client->put("api/events/{$eventId}/notes/{$noteId}", [
'json' => [
'content' => 'This is an updated note content',
],
]);
$updatedNote = json_decode($response->getBody(), true);
$eventId = 1;
$noteId = 1;
$response = $client->delete("api/events/{$eventId}/notes/{$noteId}");
echo $response->getStatusCode() == 204 ? "Note deleted successfully" : "Failed to delete note";
$eventId = 1;
$response = $client->post("api/events/{$eventId}/attachments", [
'multipart' => [
[
'name' => 'attachment',
'contents' => fopen('path/to/document.pdf', 'r'),
'filename' => 'important_document.pdf',
],
],
]);
$attachment = json_decode($response->getBody(), true);
$eventId = 1;
$attachmentId = 1;
$response = $client->delete("api/events/{$eventId}/attachments/{$attachmentId}");
echo $response->getStatusCode() == 204 ? "Attachment removed successfully" : "Failed to remove attachment";
$eventId = 1;
$response = $client->post("api/events/{$eventId}/images", [
'multipart' => [
[
'name' => 'image',
'contents' => fopen('path/to/image.jpg', 'r'),
'filename' => 'event_image.jpg',
],
],
]);
$image = json_decode($response->getBody(), true);
$eventId = 1;
$imageId = 1;
$response = $client->delete("api/events/{$eventId}/images/{$imageId}");
echo $response->getStatusCode() == 204 ? "Image removed successfully" : "Failed to remove image";
bash
php artisan vendor:publish --provider="BamboleeDigital\EventUserManager\EventUserManagerServiceProvider" --tag="config"