本文整理汇总了PHP中Country::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::create方法的具体用法?PHP Country::create怎么用?PHP Country::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$val = $this->tagRepository->getCreateForm();
if (!$val->isValid()) {
return Redirect::back()->withInput()->withErrors($val->getErrors());
}
if (!($record = $this->tagRepository->create($val->getInputData()))) {
return Redirect::back()->with('errors', $this->tagRepository->errors())->withInput();
}
return Redirect::action('AdminTagsController@index')->with('success', 'Tag Created');
}
示例2: run
public function run()
{
DB::table('mst_countries')->truncate();
$country_name_full = array();
$country_name_file = app_path() . "/country_name_new.txt";
$myfile_country_name = fopen($country_name_file, "r") or die("Unable to open file!");
$read_country_name_file = fread($myfile_country_name, filesize($country_name_file));
$array_country_names = explode("\n", $read_country_name_file);
foreach ($array_country_names as $key_country_names) {
if ($key_country_names != null) {
$country_name_list = explode(" ", $key_country_names);
$country_name_full[$country_name_list[0]] = $country_name_list[1];
}
}
$country_name_ja = "";
$file_folder = public_path() . "/flags/";
//use the directory class
$files = dir($file_folder);
//read all files ;from the directory
chdir($file_folder);
$file_names = glob('*.png');
$i = 1;
//$c = 1;
foreach ($file_names as $file_name) {
$country_name_en = explode('.', $file_name, -1);
if (!empty($country_name_full[$country_name_en[0]])) {
$country_name_ja = $country_name_full[$country_name_en[0]];
}
$country = array("country_name" => $country_name_en[0], "flag_url" => "flags/" . $file_name, "country_name_ja" => $country_name_ja);
Country::create($country);
$i++;
echo $i . "\n";
}
closedir($files->handle);
}
示例3: run
public function run()
{
DB::table('country')->delete();
Country::create(array('name' => 'México', 'key' => 'MX'));
Country::create(array('name' => 'Estados Unidos', 'key' => 'EUA'));
Country::create(array('name' => 'Canadá', 'key' => 'CA'));
}
示例4: run
public function run()
{
$countries = array("France", "Belgique", "USA");
for ($i = 0; $i < sizeof($countries); $i++) {
Country::create(["nom" => $countries[$i]]);
}
}
示例5: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Country::create([]);
}
}
示例6: run
public function run()
{
$faker = Faker::create();
Country::deleteAll();
foreach (range(1, 10) as $index) {
try {
Country::create(['title' => $faker->country]);
} catch (\Exception $e) {
}
}
}
示例7: camp_html_breadcrumbs
$correct = true;
$created = false;
if (empty($f_country_name)) {
$correct = false;
$errorMsgs[] = getGS("You must fill in the $1 field.", "<B>".getGS("Name")."</B>");
}
if (!$language->exists()) {
$correct = false;
$errorMsgs[] = getGS('You must select a language.');
}
if ($correct) {
$newCountry = new Country($f_country_code, $f_country_new_language);
$created = $newCountry->create(array('Name' => $f_country_name));
if ($created) {
camp_html_goto_page("/$ADMIN/country/");
} else {
$errorMsgs[] = getGS('The country name $1 could not be translated','<B>'.$country->getName().'</B>');
}
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Countries"), "/$ADMIN/country/");
$crumbs[] = array(getGS("Adding new translation"), "");
echo camp_html_breadcrumbs($crumbs);
?>
<P>
示例8: camp_html_breadcrumbs
$errorMsgs = array();
if (empty($f_country_code)) {
$errorMsgs[] = $translator->trans('You must fill in the $1 field.', array('$1' => '<B>' . $translator->trans('Code') . '</B>'));
$correct = false;
}
if (empty($f_country_name)) {
$errorMsgs[] = $translator->trans('You must fill in the $1 field.', array('$1' => '<B>' . $translator->trans('Name') . '</B>'));
$correct = false;
}
if (empty($f_country_language) || $f_country_language == 0) {
$correct = false;
$errorMsgs[] = $translator->trans('You must select a language.');
}
if ($correct) {
$country = new Country($f_country_code, $f_country_language);
$created = $country->create(array("Name" => $f_country_name));
if ($created) {
camp_html_goto_page("/{$ADMIN}/country/");
} else {
$errorMsgs[] = $translator->trans('The country $1 could not be created.', array('$1' => '<strong>' . $f_country_name . '</strong>'), 'country');
$errorMsgs[] = $translator->trans('Country with code $1 exists already.', array('$1' => $f_country_code), 'country');
}
}
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Add new country"), "");
echo camp_html_breadcrumbs($crumbs);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
示例9: add
/**
* undocumented function
*
* @return void
* @author
**/
public static function add(array $input)
{
return Country::create($input);
}