Skip to content

Commit

Permalink
Make should authorize a public property
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Mar 6, 2017
1 parent 842eb06 commit c9bd96a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class BookController extends Controller
{
use Index, Show, Update, Store, Delete;

//this is optional and will call authorize methods on default traits

public $shouldAuthorize = true;

/**
* @param Book $bookModel
* @param BookTransformer $transformer
Expand All @@ -59,7 +63,6 @@ class BookController extends Controller
$this
->setTransformer($transformer)
->setModel($bookModel);
//optionally add `shouldAuthorize` to add authorize checks in built in traits
}
}
```
Expand Down
10 changes: 0 additions & 10 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public function setModel($model) {
return $this;
}

/**
* Calls authorization methods on the default traits
*
* @return mixed
*/
public function shouldAuthorize() {
$this->shouldAuthorize = true;
return $this;
}

/**
* Sets resource key for fractal
*
Expand Down

0 comments on commit c9bd96a

Please sign in to comment.