mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
add disable user method
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Http\Middleware\Locale;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
@@ -154,4 +155,13 @@ class User extends Authenticatable
|
||||
return $this->belongsTo(User::class, 'invited_by');
|
||||
}
|
||||
|
||||
public function updateWithModComment(array $update, $modComment)
|
||||
{
|
||||
if (!$this->exists) {
|
||||
throw new \RuntimeException('User not exists!');
|
||||
}
|
||||
$update['modcomment'] = DB::raw("concat_ws('\n', $modComment, modcomment)");
|
||||
return $this->update($update);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user