Skip to content

Commit

Permalink
refactor: remove explicit GoogleClient::class dependency in GoogleApi…
Browse files Browse the repository at this point in the history
…Manager
  • Loading branch information
tomshaw committed Apr 18, 2024
1 parent 0881332 commit c289cfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ This package includes a Google `Calendar` and `Gmail` adapter classes. Feel free
> Using the client to create a calendar event for the following day 1:00PM.
```php
public function add(GoogleClient $client)
public function add()
{
$calendar = GoogleApi::calendar($client);

$calendar->setCalendarId('[email protected]');
$calendar = GoogleApi::calendar()->setCalendarId('[email protected]');

$summary = 'Test Event';
$location = '123 Test St, Test City, TS';
Expand All @@ -150,7 +148,7 @@ This package includes a Google `Calendar` and `Gmail` adapter classes. Feel free
> Using the client to send emails.
```php
public function mount(GoogleClient $client, Order $id)
public function mount(Order $id)
{
$model = Order::with(['user'])->where('id', $id)->first();

Expand All @@ -159,7 +157,7 @@ This package includes a Google `Calendar` and `Gmail` adapter classes. Feel free
storage_path('app/public/invoice.pdf'),
];

$gmail = GoogleApi::gmail($client);
$gmail = GoogleApi::gmail();
$gmail->from('[email protected]', 'Company Name');
$gmail->to($model->user->email, $model->user->name);
$gmail->cc('[email protected]');
Expand Down
8 changes: 4 additions & 4 deletions src/GoogleApiManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

class GoogleApiManager
{
public function gmail(GoogleClient $client): GoogleMail
public function gmail(): GoogleMail
{
return new GoogleMail($client);
return new GoogleMail(app(GoogleClient::class));
}

public function calendar(GoogleClient $client): GoogleCalendar
public function calendar(): GoogleCalendar
{
return new GoogleCalendar($client);
return new GoogleCalendar(app(GoogleClient::class));
}
}

0 comments on commit c289cfd

Please sign in to comment.