Thursday, June 16, 2016

Note 16-Jun-2016

1. Finish lesson incremental api development
https://laracasts.com/series/incremental-api-development
https://github.com/rattfieldnz/laravel-incremental-api.git

2.  fractal provides a presentation and transformation layer for complex data output
    fractal.thephpleague.com

3. php artisan generate:pivot lessons tags   
this will create pivot table refer to CreateLessonTagTable
    public function up()
    {
        Schema::create('lesson_tag', function(Blueprint $table)
        {
            $table->increments('id');
            $table->integer('lesson_id')->unsigned()->index();
            $table->foreign('lesson_id')->references('id')->on('lessons')->onDelete('cascade');
            $table->integer('tag_id')->unsigned()->index();
            $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
        });
    }

4. thinking about if added new field what is the impact.   

5. abstract class   
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
  
7.  Traits and classes is defined in a way which reduces complexity, and avoids the typical problems associated with multiple inheritance and Mixins

As of PHP 5.4.0, PHP implements a method of code reuse called Traits.

Traits are a mechanism for code reuse in single inheritance languages such as PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. The semantics of the combination of Traits and classes is defined in a way which reduces complexity, and avoids the typical problems associated with multiple inheritance and Mixins.

A Trait is similar to a class, but only intended to group functionality in a fine-grained and consistent way. It is not possible to instantiate a Trait on its own. It is an addition to traditional inheritance and enables horizontal composition of behavior; that is, the application of class members without requiring inheritance.

No comments:

Post a Comment