Membuat Controller dan Model Otomatis Pada VSC - sopian aji

Terbaru

Jumat, 10 September 2021

Membuat Controller dan Model Otomatis Pada VSC

1. File-Preferences-User Snippets


2. Pilih html.json



3. berikut script code yang digunakan
{
    // Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    // same ids are connected.
    // Example:
    // "Print to console": {
    //  "prefix": "log",
    //  "body": [
    //      "console.log('$1');",
    //      "$2"
    //  ],
    //  "description": "Log output to console"
    // }

    "php <?php..?>":{
        "prefix""php",
        "body""<?php $1 ?>"
    },

    "Codeigniter Controller":{
        "prefix""cicontroller",
        "body": [
            "<?php",
            "defined('BASEPATH') OR exit('No direct script access allowed');",
            "",
            "class ${Classname} extends CI_Controller{",
            "",
            "\tpublic function __construct()",
            "\t{",
            "\t\tparent::__construct();",
            "\t\t//Codeigniter : Write Less Do More",
            "\t}",
            "",
            "\tfunction index()",
            "\t{",
            "\t",
            "\t}",
            "",
            "}"
        ]
    },

    "Codeigniter Model":{
        "prefix""cimodel",
        "body": [
            "<?php",
            "defined('BASEPATH') OR exit('No direct script access allowed');",
            "",
            "class ${Classname} extends CI_Model{",
            "private $$table = 'table';",
            "private $$pk    = 'pk';",
            "",
            "\tpublic function ${FunctionName} (Type $$var = null)",
            "\t{",
            "\t\t// code...",
            "\t}",
            "",
            "}"
        ]
    }

    // laravel
    // php artisan serve
     

}


Tidak ada komentar:

Posting Komentar