mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Fixed manufacturer gates
This commit is contained in:
parent
a65ea639ed
commit
3df62a200f
|
@ -35,6 +35,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
$this->authorize('index', Manufacturer::class);
|
||||||
return view('manufacturers/index', compact('manufacturers'));
|
return view('manufacturers/index', compact('manufacturers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
|
$this->authorize('create', Manufacturer::class);
|
||||||
return view('manufacturers/edit')->with('item', new Manufacturer);
|
return view('manufacturers/edit')->with('item', new Manufacturer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +67,7 @@ class ManufacturersController extends Controller
|
||||||
public function store(ImageUploadRequest $request)
|
public function store(ImageUploadRequest $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->authorize('edit', Manufacturer::class);
|
||||||
$manufacturer = new Manufacturer;
|
$manufacturer = new Manufacturer;
|
||||||
$manufacturer->name = $request->input('name');
|
$manufacturer->name = $request->input('name');
|
||||||
$manufacturer->user_id = Auth::user()->id;
|
$manufacturer->user_id = Auth::user()->id;
|
||||||
|
@ -104,6 +107,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function edit($id = null)
|
public function edit($id = null)
|
||||||
{
|
{
|
||||||
|
$this->authorize('edit', Manufacturer::class);
|
||||||
// Check if the manufacturer exists
|
// Check if the manufacturer exists
|
||||||
if (is_null($item = Manufacturer::find($id))) {
|
if (is_null($item = Manufacturer::find($id))) {
|
||||||
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||||
|
@ -125,6 +129,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update(ImageUploadRequest $request, $manufacturerId = null)
|
public function update(ImageUploadRequest $request, $manufacturerId = null)
|
||||||
{
|
{
|
||||||
|
$this->authorize('edit', Manufacturer::class);
|
||||||
// Check if the manufacturer exists
|
// Check if the manufacturer exists
|
||||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||||
// Redirect to the manufacturer page
|
// Redirect to the manufacturer page
|
||||||
|
@ -186,6 +191,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function destroy($manufacturerId)
|
public function destroy($manufacturerId)
|
||||||
{
|
{
|
||||||
|
$this->authorize('delete', Manufacturer::class);
|
||||||
// Check if the manufacturer exists
|
// Check if the manufacturer exists
|
||||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||||
// Redirect to the manufacturers page
|
// Redirect to the manufacturers page
|
||||||
|
@ -224,6 +230,7 @@ class ManufacturersController extends Controller
|
||||||
*/
|
*/
|
||||||
public function show($manufacturerId = null)
|
public function show($manufacturerId = null)
|
||||||
{
|
{
|
||||||
|
$this->authorize('view', Manufacturer::class);
|
||||||
$manufacturer = Manufacturer::find($manufacturerId);
|
$manufacturer = Manufacturer::find($manufacturerId);
|
||||||
|
|
||||||
if (isset($manufacturer->id)) {
|
if (isset($manufacturer->id)) {
|
||||||
|
|
Loading…
Reference in a new issue