当前位置: 首页>>代码示例>>PHP>>正文


PHP Resource::create方法代码示例

本文整理汇总了PHP中Resource::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::create方法的具体用法?PHP Resource::create怎么用?PHP Resource::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resource的用法示例。


在下文中一共展示了Resource::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Resource::create([]);
     }
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:7,代码来源:ResourcesTableSeeder.php

示例2: run

 public function run()
 {
     $tableresource = "resource";
     $tablegroupresource = "group_resource";
     $resources = [["pattern" => "/stock", "name" => "stock/index", "target" => "StockController@indexAction", "secure" => true], ["pattern" => "/stock/add", "name" => "stock/add", "target" => "StockController@addAction", "secure" => true], ["pattern" => "/stock/edit", "name" => "stock/edit", "target" => "StockController@editAction", "secure" => true], ["pattern" => "/stock/delete", "name" => "stock/delete", "target" => "StockController@deleteAction", "secure" => true], ["pattern" => "/stock/addrow", "name" => "stock/addrow", "target" => "StockController@addrowAction", "secure" => true]];
     foreach ($resources as $resource) {
         DB::unprepared('ALTER TABLE ' . $tableresource . ' AUTO_INCREMENT = 1');
         DB::unprepared('ALTER TABLE ' . $tablegroupresource . ' AUTO_INCREMENT = 1');
         $r = Resource::create($resource);
         $id = Group::where('id', '=', 1)->first()->id;
         $r->groups()->attach(array($id));
     }
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:13,代码来源:ResourceSeeder.php

示例3: testUrlVisit

 public function testUrlVisit()
 {
     $uri = 'foo/bar/url-testing';
     $newUri = 'foo/new-url-testing';
     $title = 'URL testing';
     $resource = Resource::create(['title' => $title, 'uri' => $uri]);
     $response = $this->call('GET', '/' . $uri);
     $this->assertEquals($title, $response->getContent(), 'Invalid response from controller.');
     $resource->uri = $newUri;
     $resource->save();
     $response = $this->call('GET', '/' . $uri);
     $this->assertRedirectedTo('/' . $newUri);
     $this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException');
     $response = $this->call('GET', '/foo/bar');
 }
开发者ID:luminark,项目名称:url,代码行数:15,代码来源:UrlTest.php

示例4: GETPOST

 if (!$cancel) {
     $error = '';
     $ref = GETPOST('ref', 'alpha');
     $description = GETPOST('description', 'alpha');
     $fk_code_type_resource = GETPOST('fk_code_type_resource', 'alpha');
     if (empty($ref)) {
         $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref"));
         setEventMessage($mesg, 'errors');
         $error++;
     }
     if (!$error) {
         $object = new Resource($db);
         $object->ref = $ref;
         $object->description = $description;
         $object->fk_code_type_resource = $fk_code_type_resource;
         $result = $object->create($user);
         if ($result > 0) {
             // Creation OK
             $db->commit();
             setEventMessage($langs->trans('ResourceCreatedWithSuccess'));
             Header("Location: card.php?id=" . $object->id);
             return;
         } else {
             // Creation KO
             setEventMessage($object->error, 'errors');
             $action = '';
         }
     } else {
         $action = '';
     }
 } else {
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:add.php

示例5: function

require_once 'Helper.php';
require_once 'routes/news.php';
require_once 'routes/tags.php';
require_once 'routes/resource.php';
require_once 'routes/category.php';
require_once 'routes/photo.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->group('/news', function () use($app) {
    News::create($app);
});
$app->group('/tags', function () use($app) {
    Tags::create($app);
});
$app->group('/resources', function () use($app) {
    Resource::create($app);
});
$app->group('/category', function () use($app) {
    Category::create($app);
});
$app->group('/album', function () use($app) {
    Photo::create($app);
});
$app->get('/ninja', function () use($app) {
    chdir('../ninja');
    $ninja = glob('*');
    $res = array();
    foreach ($ninja as $n) {
        array_push($res, ['name' => $n, 'url' => "/ninja/{$n}/"]);
    }
    echo json_encode($res);
开发者ID:PisaCoderDojo,项目名称:dojo-wp-site,代码行数:31,代码来源:index.php


注:本文中的Resource::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。