Initial setup

This commit is contained in:
Fairuz
2021-06-17 20:12:08 +08:00
commit ee1a7a12cc
247 changed files with 29192 additions and 0 deletions
@@ -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');
}
}
}