Update api requests
This commit is contained in:
19
models/Right.php
Normal file
19
models/Right.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Right extends Model {
|
||||
protected $table = 'rights';
|
||||
|
||||
public static function add($code, $name) {
|
||||
if (Right::where('code', $code)->count() == 0) {
|
||||
$right = new Right([
|
||||
'code' => $code,
|
||||
'name' => $name,
|
||||
]);
|
||||
$right->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user