Beispiel #1
0
 protected function eraseData()
 {
     Foo::truncate();
     Bar::truncate();
     Baz::truncate();
     Bom::truncate();
 }
    {
        $filenum = fopen($filename, "w");
        flock($filenum, LOCK_EX);
        fwrite($filenum, $data);
        fclose($filenum);
        return TRUE;
    }
    public function get_bom_files()
    {
        $this->check_dir();
        return $this->bom_files;
    }
    public function auto_remove_file_bom()
    {
        foreach ($this->bom_files as $bom_file) {
            if ($this->remove_file_with_bom($bom_file)) {
                return 'success';
            }
        }
    }
    public function start_handle_files()
    {
        $bom_files = $this->get_bom_files();
        $ret = array('bom_files' => $bom_files);
        empty($this->auto_rewrite) or $ret['remove_ret'] = $this->auto_remove_file_bom();
        return json_encode($ret);
    }
}
//使用示例:
$bom_obj = new Bom(__DIR__, 0);
echo $bom_obj->start_handle_files();
 /** @test */
 public function it_stores_related_model_in_relations_field()
 {
     $bom = Bom::includes('bar')->where('bar.id', '=', 1)->first();
     $this->assertArrayNotHasKey('bar', $bom->attributesToArray());
     $this->assertInstanceOf('Bar', $bom->getRelation('bar'));
 }