Skip to content

Commit

Permalink
Merge pull request #2 from olssonm/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
olssonm authored Jul 5, 2016
2 parents d0db3fc + 35573b0 commit 8eab551
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ The view is located in your views-folder `/humans/humans.blade.php`.
It's also valid to put this in your `<head>`:

``` html
<link type="text/plain" rel="author" href="http://domain/humans.txt" />
<link type="text/plain" rel="author" href="http://domain.com/humans.txt" />
```

If you by any chance need to access your `humans.txt` via a named route, that's also possible:

``` html
<link type="text/plain" rel="author" href="{{ route('humans.txt') }}" />
```

## Learn more
Expand Down
15 changes: 15 additions & 0 deletions src/Http/Controllers/HumansController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Olssonm\Humans\Http\Controllers;

use Illuminate\Routing\Controller;

class HumansController extends Controller
{
public function humans()
{
return response()
->view('humans::humans')
->header('Content-Type', 'text/plain');
}
}
9 changes: 4 additions & 5 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

Route::get('humans.txt', function () {
return response()
->view('humans::humans')
->header('Content-Type', 'text/plain');
});
Route::get('humans.txt', [
'as' => 'humans.txt',
'uses' => 'Olssonm\Humans\Http\Controllers\HumansController@humans'
]);
20 changes: 20 additions & 0 deletions tests/HumansTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public function testVisitDefault()
->see('This is the default humans.txt-template');
}

/**
* Test a default visit using named route
* @test
*/
public function testVisitDefaultNamed()
{
$this->visit(route('humans.txt'))
->see('This is the default humans.txt-template');
}

/**
* Test to publish vendor assets
* @test
Expand Down Expand Up @@ -75,6 +85,16 @@ public function testVisitInstalled()
->see('Developer: Joe Doe');
}

/**
* Test an installed visit
* @test
*/
public function testVisitInstalledNamed()
{
$this->visit(route('humans.txt'))
->see('Developer: Joe Doe');
}

/**
* Tear down and remove files
*/
Expand Down

0 comments on commit 8eab551

Please sign in to comment.