mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Adjusted missing down on migration and code smells
This commit is contained in:
parent
3a0b03348e
commit
e8d0147075
|
@ -314,7 +314,7 @@ class AccessoriesController extends Controller
|
|||
*/
|
||||
public function checkin(Request $request, $accessoryUserId = null)
|
||||
{
|
||||
if (is_null($accessory_checkout = DB::table('accessories_checkout')->find($accessoryUserId))) {
|
||||
if (is_null($accessory_checkout = AccessoryCheckout::find($accessoryUserId))) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/accessories/message.does_not_exist')));
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ class AccessoriesController extends Controller
|
|||
$logaction = $accessory->logCheckin(User::find($accessory_checkout->assigned_to), $request->input('note'));
|
||||
|
||||
// Was the accessory updated?
|
||||
if (DB::table('accessories_checkout')->where('id', '=', $accessory_checkout->id)->delete()) {
|
||||
if ($accessory_checkout->delete()) {
|
||||
if (! is_null($accessory_checkout->assigned_to)) {
|
||||
$user = User::find($accessory_checkout->assigned_to);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,10 @@ return new class extends Migration
|
|||
public function down(): void
|
||||
{
|
||||
if (Schema::hasTable('accessories_checkout')) {
|
||||
Schema::table('accessories_checkout', function (Blueprint $table) {
|
||||
$table->dropColumn('assigned_type');
|
||||
});
|
||||
|
||||
Schema::rename('accessories_checkout', 'accessories_users');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue