Giter Site home page Giter Site logo

pemrograman_backend's Introduction

Hallo😄

pemrograman_backend's People

Contributors

zharonk avatar

Watchers

 avatar

pemrograman_backend's Issues

Feedback UTS - Fix Bug di Model

Terima kasih sudah mengerjakan Final Project UTS.

Berikut adalah beberapa Feedback secara umum:

  • Semua ketentuan requirement dan endpoint terpenuhi, namun ada beberapa catatan.
  • Sudah menerapkan Authentication Sanctum untuk melindungi API.
  • Sudah menerapkan normalisasi, relationship namun ada beberapa kesalahan dalam mendefinisikan model dan relasi.

Catatan:

  • Get All Resource: Mengirim response data is empty jika data kosong.
  • Get Detail Resrouce: Masih belum berfungsi karena salah dalam membuat relasi antar table.
  • Menampilkan nama status bukan id status.

Route:

  • Routing untuk search adalah patients bukan patiens.

Model:

  • Relasi antar model masih salah, sehingga tidak bisa mengakses resource (Get Detail Resource).
  • Nama kolom di database harus bersifat snake_case (status_patients) bukan camel case (statusPatient)
  • Nama model harus Capital dan Singular. Ex: Status, Patient. Ini merupakan konvensi dari laravel. Referensi
  • Model Patient mereferensikan ke table patients. Jika nama tablenya berbeda, maka beritahu nama kolomnya di Model. Referensi
  • Jika foreign key berbeda, maka definisikan foreign key di dalam relasi.

Controller:

  • Laravel menyediakan option --api untuk generate method API. ex: php artisan make:controller StudentController --api. Referensi

Fix this bug:

  1. Model statusPatient
class statusPatient extends Model
{
    use HasFactory;
    protected $fillable = ['status'];
    protected $table = 'statusPatient';

    public function patient()
    {
        return $this->hasMany(Patient::class, "statusPatient_id");
    }
}
  1. Model Patient
class Patient extends Model
{
    use HasFactory;
    protected $fillable = ['nama_pasien', 'nomor_hp', 'alamat', 'statusPatient_id', 'tanggal_masuk', 'tanggal_keluar'];


    public function statusPatient()
    {
        return $this->belongsTo(statusPatient::class, "statusPatient_id");
    }
}

Semoga ilmunya bermanfaat dan bisa dikontribusikan pada hal yang lebih besar. Jangan pernah berhenti mencari dan menggembangkan minatnya, jika lelah koding silahkan istirahat tapi jangan berhenti dan menyerah.

Salam, Aufa Billah (Teman Koding Anda).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.