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


PHP Article::first方法代码示例

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


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

示例1: postAdd

 public function postAdd()
 {
     $title = 'Nuevo artículo';
     if (Auth::user() && (Auth::user()->permitido('administrador') || Auth::user()->permitido('remisionero'))) {
         $input = Input::all();
         //Redondea a dos decimales el costo
         $input['cost'] = round($input['cost'], 2);
         //Redondea a dos decimales el precio
         $input['price'] = round($input['price'], 2);
         $v = Validator::make($input, Article::$rules, Article::$messages);
         if ($v->passes()) {
             $idArticle = 1;
             try {
                 $this->article->create($input);
                 $input['id'] = Article::first()->orderBy('created_at', 'desc')->first()->id;
                 $idArticle = $input['id'];
                 self::logChanges(array_except($input, '_token'));
             } catch (Exception $e) {
                 // $message = $e->getMessage();
                 $message = 'No se ha podido guardar el nuevo artículo, quizá exista otro artículo con ese nombre.';
                 Session::flash('message', $message);
                 return Redirect::to('articles/add')->withInput();
             }
             return Redirect::to('articles/search?filterBy=id&search=' . $idArticle)->with(array('messageOk' => 'Artículo creado con éxito.'));
         }
         return Redirect::to('articles/add')->withInput()->withErrors($v)->with('message');
     }
 }
开发者ID:heromdn,项目名称:inventarios,代码行数:28,代码来源:ArticleController.php

示例2: home

 public function home()
 {
     // var_dump(Article::count());
     $data = ['title' => '你是谁??', 'email' => '1@baiducom'];
     $validator = $this->validate($data, ['title' => 'required|numeric|integer|min:3|max:4', 'email' => 'required|email']);
     if (!$validator->success) {
         foreach ($validator->errors as $error) {
             echo $error . '<br>';
         }
     }
     Log::debug('First Debug Info.');
     /*
     // mail sample
     Mail::to('foo@bar.io')->from('bar@foo.io')
                           ->title('Foo Bar')
                           ->content('<h1>Hello~~</h1>')
                           ->send();
     // redis sample
     Redis::set('key','value',3000,'ms');
     echo Redis::get('key');
     */
     // return View
     return View::make('home')->with('article', Article::first())->withTitle('TinyLara :-D')->withFooBar('foo_bar');
     // return String
     return 'Hello TinyLara!';
     // or you can return Nothing.
 }
开发者ID:chenjiantan,项目名称:TinyLara,代码行数:27,代码来源:HomeController.php

示例3: home

 public function home()
 {
     $this->view = View::make('home')->with('article', Article::first())->withTitle('MFFC:-D')->withHome('ok!');
     // ->withName(Redis::get('name'));
     //        $this->mail = Mail::to('943032656@qq.com')
     //            ->from('zwz19940115@163.com')
     //            ->title('Fuck Me!')
     //            ->content('<h1>Hello~~</h1>');
 }
开发者ID:zuofang,项目名称:foo,代码行数:9,代码来源:HomeController.php

示例4: testDeleteArticleWithExistedId

 public function testDeleteArticleWithExistedId()
 {
     //get ramdom id from artidles
     $article = Article::first();
     if ($article instanceof Article) {
         $response = $this->call('DELETE', '/article/' . ($id = $article->id), $params = array(), $file = array(), $server = array(), null);
         $this->assertResponseStatus(204);
     }
 }
开发者ID:nguyentienlong,项目名称:laravel.sandbox,代码行数:9,代码来源:ArticleControllerTest.php

示例5: index

 public function index()
 {
     $result = Test::first();
     echo "<pre>";
     // var_dump($result);
     $first = Article::find(1);
     var_dump($first->content);
     echo '<h1>this is index</h1>';
     $this->view = View::make('home')->with('article', Article::first())->withTitle('MFFC :-D')->withFuck('Ok!');
 }
开发者ID:jceee,项目名称:MFFC,代码行数:10,代码来源:IndexController.php

示例6: home

 public function home()
 {
     $this->view = View::make('home')->with('article', Article::first())->withTitle('MFFC :-D')->withFuckMe('OK!');
     // $this->mail = Mail::to(['ooxx@gmail.com', 'ooxx@qq.com'])
     //                     ->from('MotherFucker <ooxx@163.com>')
     //                     ->title('Fuck Me!')
     //                     ->content('<h1>Hello~~</h1>');
     Redis::set('key', 'value', 3000, 'ms');
     echo Redis::get('key');
 }
开发者ID:xinson,项目名称:My-First-Framework-based-on-Composer,代码行数:10,代码来源:HomeController.php

示例7: home

 public function home()
 {
     $article = Article::first();
     $this->view = View::make('home')->with('article', $article)->withTitle('title')->withFuckMe('OK!');
     /*$this->mail = Mail::to(['xxx@qq.com'])
     
                 ->from('MotherFucker <xxx@163.com>')
     
                 ->title('Fuck Me!')
     
                 ->content('<h1>Hello~~</h1>');*/
 }
开发者ID:fifths,项目名称:lit,代码行数:12,代码来源:HomeController.php

示例8: home

 public function home()
 {
     /*$url = parse_url($_SERVER['REQUEST_URI']);
     		$method = $_SERVER['REQUEST_METHOD'];
     		echo '<pre>';
     		var_export($method);
     		var_export($url);
     		echo '</pre>';*/
     #echo '<h1>控制器成功</h1>';
     #
     $this->view = View::make("home")->with('article', Article::first())->withTitle('MFFC : -D')->withFuckMe('OK!');
     //发邮件
     $this->mail = Mail::to(['532974019@qq.com'])->from('MontherFucker <leezhxing@163.com>')->title('hello')->content('<h1>HELLO~~~~~</h1>');
 }
开发者ID:leezhxing,项目名称:mffc,代码行数:14,代码来源:HomeController.php

示例9: index

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $data['article'] = Article::first();
     $this->load->view('home', $data);
 }
开发者ID:NaszvadiG,项目名称:CodeIgniter-2-with-Eloquent,代码行数:20,代码来源:welcome.php

示例10: index

 public function index()
 {
     $article = Article::first();
     require dirname(__FILE__) . '/../views/test.php';
 }
开发者ID:VictorZhn,项目名称:pyramid,代码行数:5,代码来源:TestController.php

示例11: home

 public function home()
 {
     $this->view = View::make('home')->with('article', Article::first())->withTitle('MFFC :-D');
 }
开发者ID:badaozhai,项目名称:bdzmvc,代码行数:4,代码来源:HomeController.php


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