edit estandar
This commit is contained in:
parent
2a3c96545d
commit
9e42bea6a9
@ -75,12 +75,8 @@ public function showEstandar($id)
|
|||||||
|
|
||||||
public function updateEstandar(Request $request, $id)
|
public function updateEstandar(Request $request, $id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$id_user = auth()->user();
|
||||||
"id_user" => 'exists:App\Models\User,id',
|
if (Estandar::where("id", $id)->exists() && $id_user->isAdmin()) {
|
||||||
]);
|
|
||||||
|
|
||||||
$id_user = auth()->user()->id;
|
|
||||||
if (Estandar::where(["id_user" => $id_user, "id" => $id])->exists()) {
|
|
||||||
$estandar = Estandar::find($id);
|
$estandar = Estandar::find($id);
|
||||||
$estandar->name = isset($request->name) ? $request->name : $estandar->name;
|
$estandar->name = isset($request->name) ? $request->name : $estandar->name;
|
||||||
$estandar->cabecera = isset($request->cabecera) ? $request->cabecera : $estandar->cabecera;
|
$estandar->cabecera = isset($request->cabecera) ? $request->cabecera : $estandar->cabecera;
|
||||||
|
Loading…
Reference in New Issue
Block a user