Skip to content

Instantly share code, notes, and snippets.

@DianSano
Created March 18, 2020 02:39
Show Gist options
  • Select an option

  • Save DianSano/d91ade51b30ff732a5cd27e1b3d0f5fb to your computer and use it in GitHub Desktop.

Select an option

Save DianSano/d91ade51b30ff732a5cd27e1b3d0f5fb to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Perusahaan;
class ControllerPerusahaan extends Controller
{
function update(Request $req)
{
$updateperusahaan = Perusahaan::find($req->id);
$updateperusahaan->nama = $req->nama;
$updateperusahaan->alamat = $req->alamat;
$updateperusahaan->save();
echo "Update berhasil";
}
function delete(Request $req)
{
//$deletePerusahaan = Perusahaan::find($req->id);
//echo $deletePerusahaan->delete() . " baris sukses di delete";
echo Perusahaan::destroy([4,5,6,8]);
}
function save(Request $req)
{
$perusahaan = new Perusahaan;
$perusahaan->nama = $req->nama;
$perusahaan->alamat = $req->alamat;
echo $perusahaan->save() . " berhasil disimpan";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment