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


PHP Country::findById方法代码示例

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


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

示例1: getCountiesByGivenCountry

 public function getCountiesByGivenCountry($country_id)
 {
     $countryObj = new Country();
     $country = $countryObj->findById($country_id);
     $data = $country->topTerritories;
     $ret = array();
     foreach ($data as $territory) {
         $ret[$territory->county] = $territory->name;
     }
     return $ret;
 }
开发者ID:rhalff,项目名称:vdragon-api,代码行数:11,代码来源:Territory.php

示例2: isset

<?php

$cid = isset($vars[1]) ? strip_tags($vars[1]) : null;
$country = Country::findById($cid);
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => 'Study in ' . $country->getName(), 'body_class' => 'single single-ib_educator_course has-toolbar'));
$html->output('<div id="page-container">');
//$html->renderOut('site/components/toptoolbar');
$html->renderOut('site/components/header');
$html->renderOut('site/components/banner', array('country' => $country));
$html->renderOut('site/country', array('breadcrumb' => $html->render('site/components/breadcrumb', array('items' => array('Home' => uri(''), $country->getName() => false))), 'country' => $country, 'institutions' => Institution::findAllByCountryId($country->getId()), 'courses' => Course::findAllByCountryId($country->getId()), 'sidebar_right' => $html->render('site/components/sidebar_right', array('blocks' => array($html->render('site/components/sidebar_block_countries'), $html->render('site/components/sidebar_block_recent_news'), $html->render('site/components/sidebar_block_apply'))))));
$html->renderOut('site/components/countries_block', array('title' => 'Other countries to apply for', 'countries' => Country::findAllExcluding($country->getId())));
$html->renderOut('site/components/footer');
$html->output('</div>');
$html->renderOut('site/components/page_footer');
$html->renderOut('site/components/html_footer');
开发者ID:jeffreycai,项目名称:ct21,代码行数:16,代码来源:country.php

示例3: getCountry

 public function getCountry()
 {
     return Country::findById($this->getCountryId());
 }
开发者ID:jeffreycai,项目名称:ct21,代码行数:4,代码来源:Menu.class.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->tagRepository->findById($id)->delete();
     return Redirect::action('AdminTagsController@index')->with('success', 'Tag Deleted');
 }
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:11,代码来源:AdminTagsController.php

示例5: isset

<?php

$id = isset($vars[1]) ? $vars[1] : null;
$object = Country::findById($id);
if (is_null($object)) {
    HTML::forward('core/404');
}
// handle form submission
if (isset($_POST['submit'])) {
    $error_flag = false;
    /// validation
    // validation for $name
    $name = isset($_POST["name"]) ? strip_tags($_POST["name"]) : null;
    if (empty($name)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "name is required.", "zh" => "请填写name"))));
        $error_flag = true;
    }
    // validation for $image
    $image = isset($_POST["image"]) ? strip_tags(trim($_POST["image"])) : null;
    if (empty($image)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "image is required.", "zh" => "请填写image"))));
        $error_flag = true;
    }
    // validation for $banner_image
    $banner_image = isset($_POST["banner_image"]) ? strip_tags(trim($_POST["banner_image"])) : null;
    if (empty($banner_image)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "banner_image is required.", "zh" => "请填写banner_image"))));
        $error_flag = true;
    }
    // validation for $content
    $content = isset($_POST["content"]) ? $_POST["content"] : null;
开发者ID:jeffreycai,项目名称:ct21,代码行数:31,代码来源:country_edit.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->countryRepository->findById($id)->delete();
     return Redirect::action('AdminCountriesController@index');
 }
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:11,代码来源:AdminCountriesController.php

示例7: foreach

                <th>name</th>
                <th>country</th>
                <th>Actions</th>
      </tr>
  </thead>
  <tbody>
    <?php 
foreach ($objects as $object) {
    ?>
    <tr>
            <td><?php 
    echo $object->getName();
    ?>
</td>
            <td><?php 
    $country = Country::findById($object->getCountryId());
    echo $country ? $country->getName() : 'N/A';
    ?>
</td>
            <td>
        <div class="btn-group">
          <a class="btn btn-default btn-sm" href="<?php 
    echo uri('admin/menu/order/' . $object->getId());
    ?>
"><i class="fa fa-edit"></i></a>
          <?php 
    if ($object->getReserved() != 1) {
        ?>
          <a onclick="return confirm('<?php 
        echo i18n(array('en' => 'Are you sure to delete this record ?', 'zh' => '你确定删除这条记录吗 ?'));
        ?>
开发者ID:jeffreycai,项目名称:ct21,代码行数:31,代码来源:menu_list.tpl.php


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