mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Initial setup
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
abstract class AbstractDeleteRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return mixed
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function handler(Model $model){
|
||||
try{
|
||||
|
||||
if($model->delete()){
|
||||
return [];
|
||||
}
|
||||
|
||||
} catch (QueryException|\Exception $exception){
|
||||
throw new MalformedRequestException('Unable to update the record due to unexpected error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user