本文整理汇总了PHP中License::create方法的典型用法代码示例。如果您正苦于以下问题:PHP License::create方法的具体用法?PHP License::create怎么用?PHP License::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类License
的用法示例。
在下文中一共展示了License::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: seedLicenses
/**
* Seed the licenses
*
* @return void
*/
private function seedLicenses()
{
// Fetch the licenses from the json file
$this->command->info('---- DCAT Licenses ----');
$this->command->info('Trying to fetch the licenses from a local json file.');
$licenses = json_decode(file_get_contents(app_path() . '/database/seeds/data/licenses.json'));
if (!empty($licenses)) {
$this->command->info('Licenses have been found, deleting the current ones, and replacing them with the new ones.');
// Empty the licenses table
$this->command->info('Emptying the current licenses table.');
\License::truncate();
foreach ($licenses as $license) {
\License::create(array('domain_content' => $license->domain_content, 'domain_data' => $license->domain_data, 'domain_software' => $license->domain_software, 'family' => $license->family, 'license_id' => $license->license_id, 'is_generic' => @$license->is_generic, 'is_okd_compliant' => $license->is_okd_compliant, 'is_osi_compliant' => $license->is_osi_compliant, 'maintainer' => $license->maintainer, 'status' => $license->status, 'title' => $license->title, 'url' => $license->url));
}
$this->command->info('Added the licenses from a local json file.');
} else {
$this->command->info('The licenses from the json file were empty, the old ones will not be replaced.');
}
}
示例2: switch
require_once '../lib/init.php';
if (!Access::check('interface', '100')) {
UI::access_denied();
exit;
}
UI::show_header();
switch ($_REQUEST['action']) {
case 'edit':
if (isset($_POST['license_id'])) {
$license = new License($_POST['license_id']);
if ($license->id) {
$license->update($_POST);
}
$text = T_('License Updated');
} else {
License::create($_POST);
$text = T_('License Created');
}
show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
break;
case 'show_edit':
$license = new License($_REQUEST['license_id']);
case 'show_create':
require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php';
break;
case 'delete':
License::delete($_REQUEST['license_id']);
show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php');
break;
default:
$browse = new Browse();
示例3: seedLicenses
/**
* Seed the themes
*
* @return @void
*/
private function seedLicenses()
{
$this->info('---- Seeding new licenses ----');
$license_name = $this->argument('name');
$license_uri = $this->licenses_uri . $license_name;
if (substr($license_uri, -5) != '.json') {
$license_uri .= '.json';
}
// Try to get the themes from the ns.thedatatank.com (semantic data)
try {
$this->info('Trying to fetch triples from the uri: ' . $license_uri);
try {
$licenses_graph = \EasyRdf_Graph::newAndLoad($license_uri, 'jsonld');
} catch (\EasyRdf_Http_Exception $ex) {
$this->info('We could not fetch licenses from the URL ' . $license_uri . ', defaulting to ' . $this->DEFAULT_LICENSE . '.');
$licenses_graph = $this->fetchDefaultGraph();
}
if ($licenses_graph->isEmpty()) {
$this->info('We could not fetch licenses from the URL ' . $license_uri . ', defaulting to ' . $this->DEFAULT_LICENSE . '.');
$licenses_graph = $this->fetchDefaultGraph();
} else {
$this->info('Fetched new licenses, removing the old ones.');
// Empty the licenses table
\License::truncate();
}
// Fetch the resources with a skos:conceptScheme relationship
$licenses = $licenses_graph->allOfType('cc:License');
$taxonomy_uris = array();
foreach ($licenses as $license) {
$url = '';
$title = '';
$identifier = '';
$title_resource = $license->getLiteral('dc:title');
$identifier_resource = $license->getLiteral('dc:identifier');
if (!empty($title_resource)) {
$title = $title_resource->getValue();
}
if (!empty($identifier_resource)) {
$identifier = $identifier_resource->getValue();
}
if (!$license->isBNode()) {
$url = $license->getUri();
}
\License::create(['url' => $url, 'title' => $title, 'license_id' => $identifier]);
$this->info('Added license "' . $identifier . '" with title "' . $title . '" and URI ' . $url);
}
} catch (EasyRdf_Exception $ex) {
$this->info('An error occurred when we tried to fetch online themes.');
}
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
$create = License::create($input);
return $create ? Redirect::to('licenses') : Redirect::back('error');
}