mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed manufacturer restore
This commit is contained in:
parent
0782222c6b
commit
9effa3d2ab
|
@ -247,7 +247,7 @@ class ManufacturersController extends Controller
|
||||||
*
|
*
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
* @since [v4.1.15]
|
* @since [v4.1.15]
|
||||||
* @param int $id
|
* @param int $manufacturers_id
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function restore($manufacturers_id)
|
public function restore($manufacturers_id)
|
||||||
|
@ -256,9 +256,13 @@ class ManufacturersController extends Controller
|
||||||
$manufacturer = Manufacturer::onlyTrashed()->where('id',$manufacturers_id)->first();
|
$manufacturer = Manufacturer::onlyTrashed()->where('id',$manufacturers_id)->first();
|
||||||
|
|
||||||
if ($manufacturer) {
|
if ($manufacturer) {
|
||||||
// I don't know why $manufacturer->restore(); didn't work here...
|
|
||||||
$manufacturer->restore();
|
// Not sure why this is necessary - it shouldn't fail validation here, but it fails without this, so....
|
||||||
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.restore.success'));
|
$manufacturer->setValidating(false);
|
||||||
|
if ($manufacturer->restore()) {
|
||||||
|
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.restore.success'));
|
||||||
|
}
|
||||||
|
return redirect()->back()->with('error', 'Could not restore.');
|
||||||
}
|
}
|
||||||
return redirect()->back()->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
return redirect()->back()->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ class Manufacturer extends SnipeModel
|
||||||
|
|
||||||
protected $hidden = ['user_id'];
|
protected $hidden = ['user_id'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the model should inject it's identifier to the unique
|
* Whether the model should inject it's identifier to the unique
|
||||||
* validation rules before attempting validation. If this property
|
* validation rules before attempting validation. If this property
|
||||||
|
|
Loading…
Reference in a new issue