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


PHP Entry::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Entry::create([]);
     }
 }
开发者ID:JustinMackenzie,项目名称:meal-log,代码行数:7,代码来源:EntriesTableSeeder.php

示例2: saveEntryAction

 public function saveEntryAction()
 {
     $inputs = Input::only(array('title', 'content'));
     $inputs["user_id"] = Auth::user()->id;
     $inputs["entry_at"] = new DateTime();
     $entry = Entry::create($inputs);
     return Redirect::route('blog/list');
 }
开发者ID:shiccocsan,项目名称:laravel_simple_blog,代码行数:8,代码来源:BlogController.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 150) as $index) {
         $title = $faker->sentence(rand(4, 6));
         $date = Carbon::now()->subDays(rand(1, 20));
         Entry::create(['id' => $index, 'title' => $title, 'content' => $faker->text(), 'slug' => Str::slug($title), 'author_id' => rand(1, 10), 'created_at' => $date, 'updated_at' => $date]);
     }
 }
开发者ID:judavi,项目名称:laravel-challenge,代码行数:9,代码来源:EntriesTableSeeder.php

示例4: create

 function create()
 {
     Auth::checkLoggedIn();
     $course = Course::fromId(Input::get('courseid'));
     if (!$course->canEdit(Auth::getUser())) {
         throw new Exception('You are not allowed to create an entry in this course.');
     }
     $entry = Entry::create(Auth::getUser(), $course, Input::get('title'), Input::get('description'));
     if (Input::exists('due_at')) {
         $entry->setDueTime(Input::get('due_at'));
     }
     if (Input::exists('display_at')) {
         $entry->setDisplayTime(Input::get('display_at'));
     }
     if (Input::exists('visible')) {
         $entry->setVisible(Input::getBoolean('visible'));
     }
     View::renderJson($entry->getContext(Auth::getUser()));
 }
开发者ID:brandonfrancis,项目名称:scsapi,代码行数:19,代码来源:entry_controller.php

示例5: run

 public function run()
 {
     DB::table('entries')->delete();
     copy('app/database/seeds/pictures/1.jpg', 'app/database/seeds/pictures/1b.jpg');
     copy('app/database/seeds/pictures/2.jpg', 'app/database/seeds/pictures/2b.jpg');
     copy('app/database/seeds/pictures/3.jpg', 'app/database/seeds/pictures/3b.jpg');
     copy('app/database/seeds/pictures/4.jpg', 'app/database/seeds/pictures/4b.jpg');
     copy('app/database/seeds/pictures/5.jpg', 'app/database/seeds/pictures/5b.jpg');
     copy('app/database/seeds/pictures/6.jpg', 'app/database/seeds/pictures/6b.jpg');
     copy('app/database/seeds/pictures/7.jpg', 'app/database/seeds/pictures/7b.jpg');
     copy('app/database/seeds/pictures/8.jpg', 'app/database/seeds/pictures/8b.jpg');
     Entry::create(['title' => 'Ta mère', 'content' => "Ta mère est une société montoise qui n'a pas froid aux yeux. C'est pour ça qu'on la met ici.", 'author_name' => 'François Stephany', 'author_email' => 'tulipe.moutarde@gmail.com', 'kind' => 'article', 'url' => 'http://tamere.eu', 'picture' => 'app/database/seeds/pictures/1b.jpg']);
     Entry::create(['title' => 'Ta soeur', 'content' => "Et ta soeur ? Disent-ils tous ! Et ils ont bien raison !", 'author_name' => 'Aurélien Malisart', 'author_email' => 'aurelien.malisart@gmail.com', 'kind' => 'article', 'url' => 'http://www.tasoeur.biz', 'picture' => 'app/database/seeds/pictures/2b.jpg']);
     Entry::create(['title' => 'Un événement', 'content' => "Super pechakucha créatif à Mons avec l'aide de CreativeMons et des Rendez-vous des pixelsfestival!", 'author_name' => 'Romain Carlier', 'author_email' => 'romain.carlier@gmail.com', 'kind' => 'event', 'start_date' => "2014-08-02", 'end_date' => "2014-08-02", 'url' => 'http://www.pechakucha.org/cities/mons', 'picture' => 'app/database/seeds/pictures/3b.jpg']);
     Entry::create(['title' => 'Ton frère', 'content' => "Frère Jacques, frère Jacques, dormez-vous ? Dormez-vous ? Sonnez les matines, sonnez les matines, ding dang dong", 'author_name' => 'Michaël Hoste', 'author_email' => 'michael.hoste@gmail.com', 'kind' => 'article', 'url' => 'http://desencyclopedie.wikia.com/wiki/Ton_fr%C3%A8re', 'picture' => 'app/database/seeds/pictures/4b.jpg']);
     Entry::create(['title' => 'Pechakucha', 'content' => "En japonais ça veut dire un truc comme 'blabla' (d'après Ruben mais personne n'a jamais vérifié)", 'author_name' => 'Ruben Casad', 'author_email' => 'ruben.casad@gmail.com', 'kind' => 'article', 'url' => 'http://www.pechakucha.org/', 'picture' => 'app/database/seeds/pictures/5b.jpg']);
     Entry::create(['title' => 'Barbecues 101', 'content' => "Organisés par Meaweb, l'invitation aux barbecues est lancée contractuellement maximum 3 heures à l'avance pour bien prendre tout le monde par surprise.", 'author_name' => 'Simon', 'author_email' => 'simon@gmail.com', 'kind' => 'event', 'start_date' => "2014-08-02", 'end_date' => "2014-08-02", 'url' => 'https://twitter.com/Meaweb', 'picture' => 'app/database/seeds/pictures/6b.jpg']);
     Entry::create(['title' => 'Cafés numériques', 'content' => "Beaucoup de bières et parfois une petite conférence sur du numérique. Donc rien à voir avec du café.", 'author_name' => 'Antoine', 'author_email' => 'antoine@gmail.com', 'kind' => 'event', 'start_date' => "2014-08-02", 'end_date' => "2014-08-02", 'url' => 'https://twitter.com/Meaweb', 'picture' => 'app/database/seeds/pictures/7b.jpg']);
     Entry::create(['title' => 'Rendez-vous du pixel', 'content' => "Tous les pixels s'y donnent rendez-vous, et ils sont beaucoup !", 'author_name' => 'Romain', 'author_email' => 'romain@gmail.com', 'kind' => 'event', 'start_date' => "2014-08-02", 'end_date' => "2014-08-02", 'url' => 'http://www.pixelsfestival.be/', 'picture' => 'app/database/seeds/pictures/8b.jpg']);
 }
开发者ID:CreativeMons,项目名称:creative-city,代码行数:20,代码来源:EntryTableSeeder.php

示例6: isset

$discipline = Discipline::by_id($_GET['discipline_id']);
$tournament = $discipline->get_tournament();
$season = $tournament->get_season();
$player = null;
$player_club = null;
$partner = null;
$partner_club = null;
if (!empty($_POST['player'])) {
    $player = $season->get_player_by_input($_POST['player']);
    if (!empty($_POST['player_club'])) {
        $player_club = $season->get_club_by_input($_POST['player_club']);
    }
}
if (!empty($_POST['partner'])) {
    $partner = $season->get_player_by_input($_POST['partner']);
    if (!empty($_POST['partner_club'])) {
        $partner_club = $season->get_club_by_input($_POST['partner_club']);
    }
}
$email = isset($_POST['email']) ? $_POST['email'] : null;
$seeding = isset($_POST['seeding']) ? $_POST['seeding'] : null;
$memo = isset($_POST['memo']) ? $_POST['memo'] : null;
try {
    $discipline->check_entry($player, $partner);
} catch (utils\InvalidEntryException $iee) {
    render_ajax_error('Meldung kann nicht angenommen werden: ' . $iee->getMessage());
    exit;
}
$entry = Entry::create($discipline, $player, $player_club, $partner, $partner_club, $email, $seeding, $memo);
$entry->save();
render_ajax('d/' . $discipline->id . '/', ['entry' => $entry]);
开发者ID:nishad,项目名称:bmtmgr,代码行数:31,代码来源:entry_add.php

示例7: header

        } else {
            // Creating a new Entry
            // Validate values
            if (!isset($_REQUEST['author_id'])) {
                header("HTTP/1.0 400 Bad Request");
                print "Missing Author ID";
                exit;
            }
            $title = trim($_REQUEST['entry']);
            if ($title == "") {
                header("HTTP/1.0 400 Bad Request");
                print "Empty Entry";
                exit;
            }
            // Create new Entry via ORM
            $new_entry = Entry::create($author_id, $entry);
            // Report if failed
            if ($new_entry == null) {
                header("HTTP/1.0 500 Server Error");
                print "Server couldn't create new entry.";
                exit;
            }
            //Generate JSON encoding of new Entrys
            header("Content-type: application/json");
            print $new_entry->getJSON();
            exit;
        }
    }
}
// If here, none of the above applied and URL could
// not be interpreted with respect to RESTful conventions.
开发者ID:andriyrusyn,项目名称:tracker,代码行数:31,代码来源:entry.php

示例8: fetch

 /**
  * Fetch single feed
  * @param Feed feed
  */
 public function fetch(Feed $feed)
 {
     $this->verbose('Fetching: ' . $feed->url);
     // Check HTTPS capability
     if ($feed->https == null) {
         $this->checkHttpsCapability($feed);
     }
     // Execute HTTP Request
     $request = $this->makeRequest($feed->url);
     if ($request['info']['http_code'] != 200) {
         $feed->error = '[ERROR HTTP CODE ' . $request['info']['http_code'] . ']';
         $feed->fetch_interval = 60;
         $feed->fetched();
         $feed->save();
         $this->verbose('Error Fetching: ' . $feed->url);
         return;
         // skip
     }
     if (empty($request['html'])) {
         $feed->error = '[ERROR SERVER RETURN EMPTY CONTENT]';
         $feed->fetch_interval = 60;
         $feed->fetched();
         $feed->save();
         $this->verbose('Error Fetching: ' . $feed->url);
         return;
         // skip
     }
     // Parsing feed
     $simplepie = new SimplePie();
     // $simplepie->set_cache_location( __DIR__ . '/cache/simplepie/' );
     $simplepie->set_raw_data($request['html']);
     $success = $simplepie->init();
     if ($success === false) {
         $feed->error = '[ERROR PARSING FEED]';
         $feed->fetch_interval = 60;
         $feed->fetched();
         $feed->save();
         $this->verbose('Error parsing: ' . $feed->url);
         return;
         // skip
     }
     $feed->title = $simplepie->get_title();
     $feed->link = $simplepie->get_link();
     $items = $simplepie->get_items();
     $new_entries_counter = 0;
     foreach ($items as $item) {
         $entry = Entry::create();
         $entry->hash = $item->get_id(true);
         $entry->feed_id = $feed->id;
         if (!$entry->exists()) {
             $entry->title = $item->get_title();
             $entry->permalink = htmlspecialchars_decode($item->get_permalink());
             $entry->content = $item->get_content();
             $entry->date = $item->get_date('Y-m-d H:i:s');
             if ($entry->date == null) {
                 $entry->date = date('Y-m-d H:i:s');
             }
             $categories = $item->get_categories();
             if (!empty($categories)) {
                 $entry_categories = array();
                 foreach ($categories as $category) {
                     $entry_categories[] = $category->get_label();
                 }
                 if (!empty($categories)) {
                     $entry->categories = implode(',', $entry_categories);
                 }
             }
             unset($categories, $entry_categories);
             $entry->save();
             $new_entries_counter++;
         }
     }
     // Activity detection
     if ($new_entries_counter > 0) {
         $feed->fetch_interval = 3;
     } else {
         if ($feed->fetch_interval * 1.5 <= 20) {
             $feed->fetch_interval = round($feed->fetch_interval * 1.5);
         }
     }
     $feed->error = null;
     $feed->fetched();
     $feed->save();
     $this->getFavicon($feed);
 }
开发者ID:inscriptionweb,项目名称:shaarli-api,代码行数:89,代码来源:cron.php

示例9: ajax_add_entry

 public function ajax_add_entry()
 {
     $response = array('success' => 0, 'error' => 'Something went wrong. Please try again.');
     if (wp_verify_nonce($_POST['entry_nonce'], 'entry-nonce')) {
         $miles = strlen(trim($_POST['miles'])) > 0 && is_numeric($_POST['miles']) ? abs(trim($_POST['miles'])) : 1;
         $location = new Location();
         if ($_POST['location_id'] > 0) {
             $location->id = $_POST['location_id'];
             $location->read();
             if (!$location->user_id == get_current_user_id()) {
                 $location->id = 0;
             }
         }
         if ($location->id == 0) {
             $location->user_id = get_current_user_id();
             $location->title = strlen(trim($_POST['title'])) > 0 ? trim($_POST['title']) : 'New Location';
             $location->miles = $miles;
             $location_id = Location::checkTitle($location->user_id, $location->title);
             if ($location_id > 0) {
                 $location->id = $location_id;
                 $location->update();
             } else {
                 $location->create();
             }
         }
         $entry = new Entry();
         $entry->user_id = get_current_user_id();
         $entry->entry_date = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
         $entry->mode = $_POST['mode'];
         $entry->miles = $miles;
         $entry->location = $location;
         $entry->create();
         if ($entry->id > 0) {
             $response['success'] = 1;
             $response['id'] = $entry->id;
             $response['title'] = $entry->location->title;
             $response['miles'] = number_format($entry->miles, 2);
             $response['day'] = $_POST['day'];
         }
     }
     header('Content-Type: application/json');
     echo json_encode($response);
     exit;
 }
开发者ID:TonyDeStefano,项目名称:Walk-Bike-Bus-Plugin,代码行数:44,代码来源:Controller.php

示例10: create

 /**
  * Creates an invoice and related items
  */
 public function create()
 {
     $post = Http::getParameter('POST');
     if (count($this->validate()) > 0) {
         throw new Exception('Invalid data entered', 400);
     }
     // create invoice
     if ($this->id == 'new') {
         $this->id = null;
     }
     $this->status = 'Drafted';
     $id = parent::create();
     // create entries
     $this->entries = array();
     foreach ($post['Invoice']['Entry'] as $entry) {
         $Entry = new Entry();
         $Entry->__bind($entry);
         $Entry->invoice_id = $id;
         $Entry->billed = Entry::__getDateTimeFromString($Entry->billed);
         if (!array_key_exists('total', $entry)) {
             $Entry->total = round($entry['quantity'] * $entry['amount_per'], 2);
         }
         $Entry->create();
         $this->entries[] = $Entry;
     }
     // create discounts
     $this->discounts = array();
     foreach ($post['Invoice']['Discount'] as $discount) {
         $Discount = new Discount();
         $Discount->__bind($discount);
         $Discount->invoice_id = $id;
         $Discount->create();
         $this->discounts[] = $Discount;
     }
     // update total
     $this->update_total();
     // update cache, see libraries/misc.php
     delete_cache_entry('invoices', $id);
     // return
     return $id;
 }
开发者ID:amad4biz,项目名称:invoices,代码行数:44,代码来源:Invoice.php

示例11:

		<ul>
		    <li>id = <?php 
        print $e->getID();
        ?>
</li>
		    <li>author = <?php 
        print $e->getAuthor();
        ?>
</li>
		    <li>body = <?php 
        print $e->getBody();
        ?>
</li>
		</ul>
		<?php 
    }
}
?>
		<h2>Creating</h2>
		<?php 
$e = Entry::create(1, $input);
?>
		<blockquote>
		<?php 
renderEntry($e);
?>
		</blockquote>
	</body>
</html>

开发者ID:andriyrusyn,项目名称:tracker,代码行数:29,代码来源:submit.php


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