Update Estandar->user,cabecera
This commit is contained in:
parent
40c97d1395
commit
f3fdb42751
@ -74,11 +74,16 @@ public function showEstandar($id)
|
|||||||
|
|
||||||
public function updateEstandar(Request $request, $id)
|
public function updateEstandar(Request $request, $id)
|
||||||
{
|
{
|
||||||
|
$request->validate([
|
||||||
|
"id_user" => 'exists:App\Models\User,id',
|
||||||
|
]);
|
||||||
|
|
||||||
$id_user = auth()->user()->id;
|
$id_user = auth()->user()->id;
|
||||||
if (Estandar::where(["id_user" => $id_user, "id" => $id])->exists()) {
|
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;
|
||||||
|
$estandar->id_user = isset($request->id_user) ? $request->id_user : $estandar->id_user;
|
||||||
$estandar->save();
|
$estandar->save();
|
||||||
return response([
|
return response([
|
||||||
"status" => 1,
|
"status" => 1,
|
||||||
|
@ -56,4 +56,9 @@ public function isCreadorPlan($id_plan)
|
|||||||
{
|
{
|
||||||
return plan::where('id', $id_plan)->where('id_user', $this->id)->exists();
|
return plan::where('id', $id_plan)->where('id_user', $this->id)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isEncargadoEstandar($id_estandar)
|
||||||
|
{
|
||||||
|
return Estandar::where('id', $id_estandar)->where('id_user', $this->id)->exists();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user