Show awards on user profile #703 (#866)

This commit is contained in:
Nabeel S
2020-10-11 16:06:09 -04:00
committed by GitHub
parent 151f188886
commit 193fbd369d
16 changed files with 172 additions and 62 deletions

View File

@@ -5,6 +5,8 @@ namespace App\Contracts;
use App\Support\Database;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
/**
* Class Migration
@@ -60,4 +62,22 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
}
}
}
/**
* Add an award from the migrations (for example, if you're adding an award module)
*
* @param array $award See \App\Models\Awardv
*
* @throws \Illuminate\Validation\ValidationException
*/
public function addAward(array $award)
{
$validator = Validator::make($award, \App\Models\Award::$rules);
if ($validator->fails()) {
throw new ValidationException($validator);
}
$awardModel = new \App\Models\Award($award);
$awardModel->save();
}
}