Ava framework ကို ကိုယ့်ဘာသာကိုယ်သုံးရင်းနဲ့ လိုအပ်တာတွေကို ဖြည့်လာတာ version 1.1 တောင် ရောက်လာပါပြီ။ version 1.1 မှာ ဘာတွေ အသစ်ထပ်ဖြည့်ထားလဲဆိုတော့

– bugs fixed plugin load more than one
– change Load Model only need first character is lowercase (eg: support userRouting now)
– re-add Model in model class (e.g: userRouting.php , class name is userRoutingModel)
– re-add Controller in controller class (e.g.user.php , class name is userController)
– fixed same helper load more than one time
– fixed db class for missing $this->db->sql in insert and update
– support $this->io->request_body for JSON string or XML string in post , put , delete
– support Closure (callback) in routing
– add IS (NOT) NULL in db
– support bracket in db
– fixed same view can’t load two time
– fixed same helper can’t load two time
– support $this->io->get_puts() and $this->io->get_deletes();
– support db_port
– support array_routing
– support multi function in routing

ပြင်လိုက်တဲ့ အထဲမှာ သဘောအကျဆုံး ၂ ခုကတော့ array_routing နဲ့ multi function ပဲ။

အရင်တုန်းက

[php]
<?php
$this->get_route("/","home");
$this->get_route("/test","testing");
?>
[/php]

အဲလိုပဲ ရေးလို့ ရပါတယ်။ သေသေချာချာစဥှု်းစားကြည့်တော့ $this->get_route function ကို အကြိမ်ကြိမ်ခေါ်နေတယ်။ တစ်ခေါက်တည်း ခေါ်လိုက်တာ ပိုရိုးရှင်းပြီးတော့ နားလည်လွယ်လိမ့်မယ်။ ဒါကြောင့် အောက်ကလို ရေးလို့ ရအောင် controller ကို update လုပ်ပေးခဲ့တယ်။

[php]
<?php
$get["/"]="home";
$get["/test"]="testing";
$get["/name/:username"]= "showusername";
$get["/name/:username/id/:id"]="userdetail";

$this->get_route($get);
?>
[/php]

နောက်တချက်က Multi function ပေါ့။ Array routing အဆင်ပြေသွားပေမယ့် login ဝင်ပြီးတဲ့ အခါတွေပဲ allow လုပ်ချင်လာတာ ရှိကော။ ဥပမာ။။ /dashboard/users ဆိုရင် login ဝင်ပြီးမှ allow လုပ်လို့ရမှာ။ /dashboard/users/admin/ လည်း အဲလိုပဲ။ ဒီတော့ အဲဒီ function ၂ ခုလုံးမှာ ထိပ်ပိုင်းမှာ login ဝင်ထားလားဆိုပြီး သွားသွား စစ်ပေးနေရတယ်။ ဒီတော့

[php]
<?php

$fun[0]="checklogin";
$fun[1]="showadmin";

$get[‘/admin/:username’]=$fun;
?>
[/php]

အဲလို ရေးပြီး function တစ်ခုပြီး နောက်တစ်ခု ခေါ်တာကို support လုပ်ပေးလိုက်တယ်။ တကယ်လို့ Array မသုံးချင်ရင် အောက်ကလို တကြောင်းတည်း ရေးလို့ရပါတယ်။

[php]
<?php

$get[‘/admin/:username’]="checklogin,showadmin";
?>
[/php]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Saturngod

Subscribe now to keep reading and get access to the full archive.

Continue reading