Git Product home page Git Product logo

plus-malaysia-berhad's Introduction

Plus Malaysia Berhad Website

Screenshot of the Program

 Screenshot.


๐Ÿ’ป Command that I used

  • php artisan serve
  • php artisan migrate
  • php artisan make:model Model -m
  • php artisan make:controller ExampleController --resource
  • php artisan tinker

๐Ÿค” What I learnt

  • MVC model
  • Authentication
  • Storing SQL database
  • Setup composer
  • Setup Laravel Jetstream

โœจ Code Highlight

User.php

The name store in the database should be capitalized each word (ex: My Name) eventhought the staff insert all lowercase or uppercase (Tips: Convert in Model)

public function setNameAttribute($value)
{
    $this->attributes['name'] = strtoupper($value);
}

Branch.php

Each branch has many fire extinguishers

public function fireExtinguisher(){
    return $this->hasMany(FireExtinguisher::class);
}

FireExtinguisher.php

Each fire extinguisher belongs to one branch

public function branch(){
    return $this->belongsTo(Branch::class, 'location', 'id');
}

CreateFireExtinguishersTable

 Schema::create('fire_extinguishers', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('location');
            $table->date('expiry_date');
            $table->string('serial_numbers');
            $table->string('type');
            $table->float('weight');
            $table->string('brand');
            $table->timestamps();
            $table->foreign('location')
                ->references('id')
                ->on('branches')
                ->onDelete('cascade');
        });

FireExtinguishersController.php

  public function store(Request $request)
    {
         $fireExtinguisher = FireExtinguisher::create([
            'location' => $request->input('location'),
            'expiry_date' => $request->input('expiry_date'),
            'serial_numbers' => $request->input('serial_numbers'),
            'type' => $request->input('type'),
            'weight' => $request->input('weight'),
            'brand' => $request->input('brand'),  
        ]);


        return redirect('/fire-extinguishers');
    }

๐Ÿ“บ Reference


๐Ÿ“ License

MIT


Like this website? You can show your appreciation by buying Hovah a coffee โ˜•


This website is built with โค๏ธโ€๐Ÿ”ฅ by Hovah!

plus-malaysia-berhad's People

Contributors

hovahyii avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.