Skip to content

Commit 7f676c9

Browse files
authored
Update readme.md
1 parent 24da011 commit 7f676c9

File tree

1 file changed

+1
-119
lines changed

1 file changed

+1
-119
lines changed

readme.md

Lines changed: 1 addition & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -15,127 +15,9 @@ MsGraph comes in two flavours:
1515

1616
API documentation can be found at https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/beta-overview
1717

18-
# Full documentation and install instructions
18+
# Documentation and install instructions
1919
[https://docs.dcblog.dev/laravel-microsoft-graph](https://docs.dcblog.dev/laravel-microsoft-graph)
2020

21-
## Usage for MsGraph
22-
23-
> Note this package expects a user to be logged in.
24-
25-
A routes example:
26-
27-
```php
28-
29-
Route::group(['middleware' => ['web', 'auth']], function(){
30-
Route::get('msgraph', function(){
31-
32-
if (! is_string(MsGraph::getAccessToken())) {
33-
return redirect(env('MSGRAPH_OAUTH_URL'));
34-
} else {
35-
//display your details
36-
return MsGraph::get('me');
37-
}
38-
39-
});
40-
41-
Route::get('msgraph/oauth', function(){
42-
return MsGraph::connect();
43-
});
44-
});
45-
```
46-
47-
Or using a middleware route, if user does not have a graph token then automatically redirect to get authenticated
48-
49-
```php
50-
Route::group(['middleware' => ['web', 'MsGraphAuthenticated']], function(){
51-
Route::get('msgraph', function(){
52-
return MsGraph::get('me');
53-
});
54-
});
55-
56-
Route::get('msgraph/oauth', function(){
57-
return MsGraph::connect();
58-
});
59-
```
60-
61-
Once authenticated you can call MsGraph:: with the following verbs:
62-
63-
```php
64-
MsGraph::get($endpoint, $array = [], $id = null)
65-
MsGraph::post($endpoint, $array = [], $id = null)
66-
MsGraph::put($endpoint, $array = [], $id = null)
67-
MsGraph::patch($endpoint, $array = [], $id = null)
68-
MsGraph::delete($endpoint, $array = [], $id = null)
69-
```
70-
71-
The second param of array is not always required, its requirement is determined from the endpoint being called, see the API documentation for more details.
72-
73-
The third param $id is optional when used the access token will be attempted to be retrieved based on the id. When omitted the logged in user will be used.
74-
75-
These expect the API endpoints to be passed, the url https://graph.microsoft.com/beta/ is provided, only endpoints after this should be used ie:
76-
77-
```php
78-
MsGraph::get('me/messages')
79-
```
80-
81-
## Usage for MsGraphAdmin
82-
83-
> Only administrators can login as tenants.
84-
85-
A routes example:
86-
87-
```php
88-
89-
Route::group(['middleware' => ['web', 'auth']], function(){
90-
Route::get('msgraph', function(){
91-
92-
if (! is_string(MsGraphAdmin::getAccessToken())) {
93-
return redirect(env('MSGRAPH_OAUTH_URL'));
94-
} else {
95-
//display your details
96-
return MsGraphAdmin::get('users');
97-
}
98-
99-
});
100-
101-
Route::get('msgraph/oauth', function(){
102-
return MsGraphAdmin::connect();
103-
});
104-
});
105-
```
106-
107-
Or using a middleware route, if user does not have a graph token then automatically redirect to get authenticated
108-
109-
```php
110-
Route::group(['middleware' => ['web', 'MsGraphAdminAuthenticated']], function(){
111-
Route::get('msgraph', function(){
112-
return MsGraphAdmin::get('users');
113-
});
114-
});
115-
116-
Route::get('msgraph/oauth', function(){
117-
return MsGraphAdmin::connect();
118-
});
119-
```
120-
121-
Once authenticated you can call MsGraph:: with the following verbs:
122-
123-
```php
124-
MsGraphAdmin::get($endpoint, $array = [])
125-
MsGraphAdmin::post($endpoint, $array = [])
126-
MsGraphAdmin::put($endpoint, $array = [])
127-
MsGraphAdmin::patch($endpoint, $array = [])
128-
MsGraphAdmin::delete($endpoint, $array = [])
129-
```
130-
131-
The second param is array is not always required, its requirement is determined from the endpoint being called, see the API documentation for more details.
132-
133-
These expect the API endpoints to be passed, the url https://graph.microsoft.com/beta/ is provided, only endpoints after this should be used ie:
134-
135-
```php
136-
MsGraphAdmin::get('users')
137-
```
138-
13921
## Change log
14022

14123
Please see the [changelog][3] for more information on what has changed recently.

0 commit comments

Comments
 (0)