Skip to content

Commit 04861eb

Browse files
committed
Web route change and added some documentation
1 parent 97a2404 commit 04861eb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

readme.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Once this is done, you will need to make a few additions to your user model like
5050

5151
Add the following code to your User model inside your app directory
5252

53+
```php
5354
use Notifiable, PresentableTrait, HasRoles, HasApiTokens;
5455

5556
protected $presenter = UserPresenter::class;
@@ -61,31 +62,38 @@ Add the following code to your User model inside your app directory
6162
public function profile()
6263
{
6364
return $this->hasOne('Inferno\Foundation\Models\Profile');
64-
}
65+
}
6566

6667
public function token()
6768
{
6869
return $this->hasMany('Inferno\Foundation\Models\\Token');
6970
}
71+
```
7072

7173
And make sure you have an additional $fillable property 'active' which we are
7274
using to detect whether the user is active or not.
7375

7476
You need to also add:
7577

78+
```php
7679
Passport::routes();
80+
```
7781

7882
to the AuthServiceProvider as per the Passport installation process and you need
7983
to add the middleware to web section of the middleware groups so that the
8084
ApiToken is created for each request to any api route as per Passport installation.
8185

86+
```php
8287
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
88+
```
8389

8490
And then, we need to run two commands:
8591

92+
```php
8693
php artisan migrate
8794
php artisan passport:install
8895
php artisan inferno:install
96+
```
8997

9098
Once these steps are done, you can run the migrations and run the seeders to get
9199
started with your Inferno app and start coding for your next big idea.

src/routes/web.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
/*Authenticated routes*/
2727
Route::group(['middleware' => 'auth'], function() {
2828
Route::get('/home', ['as' => 'home', 'uses' => 'HomeController@getHomePage']);
29-
Route::get('/activities', ['as' => 'user-activities', 'uses' => 'HomeController@getUserActivities']);
30-
Route::post('/logout', ['as' => 'logout', 'uses' => 'HomeController@postLogout']);
29+
Route::get('/activities', ['as' => 'user-activities', 'uses' => 'HomeController@getUserActivities']);
30+
Route::post('/logout', ['as' => 'logout', 'uses' => 'HomeController@postLogout']);
3131

3232
Route::get('user/profile', ['as' => 'profile', 'uses' => 'HomeController@pageUserProfile']);
3333
Route::post('user/profile', ['as' => 'update-profile', 'uses' => 'HomeController@postUpdateProfile']);

0 commit comments

Comments
 (0)