本文整理汇总了PHP中app\models\Article类的典型用法代码示例。如果您正苦于以下问题:PHP Article类的具体用法?PHP Article怎么用?PHP Article使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Article类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: make
/**
* Return a fresh instance of the model (called on `create()`).
*
* @return \Illuminate\Database\Eloquent\Model
*/
protected function make()
{
$model = new Article();
$model->publish_date = new Carbon();
$model->save();
return $model;
}
开发者ID:bjrnblm,项目名称:blender,代码行数:12,代码来源:ArticleController.php
示例2: testValidateCorrect
public function testValidateCorrect()
{
$model = new Article(['name' => 'name', 'text' => 'text', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'user_id' => null]);
$this->specify('event wrong', function () use($model) {
expect('model should not validate', $model->validate())->true();
});
}
开发者ID:vitalik74,项目名称:event-app,代码行数:7,代码来源:ArticleTest.php
示例3: actionFeed
public function actionFeed()
{
$this->layout = false;
$article = new Article();
$data = $article->getArticle();
return $this->render('feed', $data);
}
开发者ID:tqsq2005,项目名称:blog-cms,代码行数:7,代码来源:BlogController.php
示例4: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$article = new Article();
if (Request::isMethod('post')) {
$rules = ['title' => 'required', 'intro' => 'required', 'content' => 'required'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();
return Redirect::to('oszdmeg-te-is')->withErrors($messages)->withInput();
} else {
$article = new Article();
$article->title = Input::get('title');
$article->intro = Input::get('intro');
$article->content = Input::get('content');
$article->display_author_name = Input::get('display_author_name') == 'on' ? Input::get('display_author_name') : 1;
$article->type_id = 2;
$article->seo_url = Helpers::seo_url($article->title);
$article->user = Auth::id();
$article->save();
Session::flash('message', 'Köszönjük!.Egyik adminisztrátorunk engedélyezni fogja cikkedet a következő 30 percben.');
return Redirect::to('/');
}
}
return view('share.index')->with('article', $article);
}
开发者ID:Thor89,项目名称:horgaszkalandok,代码行数:30,代码来源:ShareController.php
示例5: syncTags
protected function syncTags(Article $article, $tagIds)
{
if (!empty($tagIds)) {
$article->tags()->sync($tagIds);
} else {
$article->tags()->detach();
}
}
开发者ID:ruslankus,项目名称:lavarel-lessons,代码行数:8,代码来源:ArticleController.php
示例6: post_mod
public function post_mod()
{
if (Input::exists()) {
$title = Input::get('title');
$mode = (int) Input::get('mode');
$article = new Article();
$article->post_mod($title, $mode);
}
}
开发者ID:bekusc,项目名称:secret-box,代码行数:9,代码来源:AppController.php
示例7: update
/**
* Update the specified resource in storage.
*
* @param Article $article
* @param ArticleRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Article $article, ArticleRequest $request)
{
$article->update($request->all());
if ($tags = $request->get('tag_list')) {
$article->tags()->sync($tags);
}
flash()->success('Article has been edited!');
return Redirect::back();
}
开发者ID:mattvb91,项目名称:website-laravel,代码行数:16,代码来源:ArticleController.php
示例8: delete
public function delete(Article $article, $id)
{
$data = $article->find($id);
if (!$data) {
return response()->json(['error' => 'data not found'], 404);
}
$data->delete();
return response()->json(200);
}
开发者ID:aririfani,项目名称:laravel-rest-api,代码行数:9,代码来源:ArticleController.php
示例9: actionDetail
public function actionDetail()
{
$id = Yii::$app->request->get('id');
$article = new Article();
$detail = $article->getDetail($id);
$comment = new Comment();
$comments = $comment->getComments($id);
$visitor = new Visitor();
echo $this->render('detail', ['detail' => $detail, 'comments' => $comments, 'visitor' => $visitor]);
}
开发者ID:tqsq2005,项目名称:blog-cms,代码行数:10,代码来源:ArticleController.php
示例10: run
/**
* composer require fzaninotto/faker
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
Article::truncate();
for ($i = 0; $i < 100; $i++) {
$article = new Article();
$article->title = $faker->sentence;
$article->excerpt = $faker->text(200);
$article->content = $faker->text(2000);
$article->author = $faker->name;
$article->category_id = $faker->numberBetween(1, count(Category::count()));
$article->save();
}
}
开发者ID:bassx1,项目名称:lessons,代码行数:20,代码来源:CreateArticlesSeed.php
示例11: seedArticle
protected function seedArticle($name, $technicalName = '', $orderColumnValue = null)
{
$article = new Article();
foreach (config('app.locales') as $locale) {
$article->translate($locale)->name = $name;
$article->translate($locale)->text = '<p class="intro">' . $this->faker->paragraph(6) . '</p>' . '<h3>' . $this->faker->sentence(6) . '</h3>' . '<p>' . $this->faker->paragraph(9) . '</p>' . '<blockquote>' . $this->faker->paragraph(7) . '</blockquote>' . '<h3>' . $this->faker->sentence(6) . '</h3>' . '<p>' . $this->faker->paragraph(10) . '</p>' . '<p>' . $this->faker->paragraph(8) . '</p>';
}
$article->online = true;
$article->technical_name = $technicalName;
$article->draft = false;
$article->order_column = $orderColumnValue;
$article->push();
$this->addImages($article);
}
开发者ID:bjrnblm,项目名称:blender,代码行数:14,代码来源:ArticleSeeder.php
示例12: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$data['article'] = Article::find($id);
ArticleStatus::update_view_number($id);
$this->setCommonData();
return view('website.article', $data);
}
开发者ID:xinzou,项目名称:blog,代码行数:13,代码来源:ArticleController.php
示例13: run
public function run()
{
DB::table('user')->delete();
DB::table('pages')->delete();
Article::create(array('title' => 'First post', 'slug' => 'first-post', 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'user_id' => 1));
Page::create(array('title' => 'About us', 'slug' => 'about-us', 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'user_id' => 1));
}
开发者ID:brucewu16899,项目名称:laravel-admin-panel,代码行数:7,代码来源:ContentSeeder.php
示例14: index
public function index()
{
$users = User::all()->count();
$trusts = Trusts::groupBy("registry")->get()->count();
$articles = Article::all()->count();
return view('admin/dashboard')->with(['users' => $users, 'trusts' => $trusts, 'articles' => $articles]);
}
开发者ID:pjnovas,项目名称:fideicomisos2015,代码行数:7,代码来源:Admin.php
示例15: insert
public function insert()
{
/** @var \app\services\GetArticle\ExtractorInterface $extractor */
$extractor = null;
switch ($this->provider) {
case 'verhosvet':
$extractor = new \app\services\GetArticle\Verhosvet($this->url);
break;
case 'youtube':
$extractor = new \app\services\GetArticle\YouTube($this->url);
break;
}
if (is_null($extractor)) {
throw new Exception('Не верный extractor');
}
$row = $extractor->extract();
$articleObject = Article::insert(['header' => $row['header'], 'content' => $row['content'], 'description' => $row['description'], 'source' => $this->url, 'id_string' => Str::rus2translit($row['header']), 'date_insert' => gmdate('YmdHis'), 'tree_node_id_mask' => (new BitMask($this->tree_node_id_mask))->getMask()]);
$this->id = $articleObject->getId();
$image = $row['image'];
$imageContent = file_get_contents($image);
$imageUrl = parse_url($image);
$pathInfo = pathinfo($imageUrl['path']);
$pathInfo['extension'];
$fields = \cs\Widget\FileUpload2\FileUpload::save(File::content($imageContent), $pathInfo['extension'], ['image', 'Картинка', 0, 'string', 'widget' => [FileUpload::className(), ['options' => ['small' => \app\services\GsssHtml::$formatIcon]]]], $this);
$articleObject->update($fields);
return true;
}
开发者ID:Makeyko,项目名称:galaxysss,代码行数:27,代码来源:ArticleFromPage.php
示例16: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
//dd($request->input());
Article::updateOrCreate(['id' => $id], $request->input());
return redirect('/commuity');
}
开发者ID:saviorZSC,项目名称:zsc_laravel,代码行数:13,代码来源:CommuityController.php
示例17: destroy
public function destroy($id)
{
$article = Article::find($id);
$article->delete();
Notification::success('The article was deleted.');
return Redirect::route('admin.articles.index');
}
开发者ID:daniellimafreire,项目名称:l4-site-tutorial,代码行数:7,代码来源:ArticlesController.php
示例18: composeSidebar
/**
* Compose the sidebar.
*/
private function composeSidebar()
{
view()->composer('partials.sidebar', function ($view) {
$view->with('latest', Article::published()->orderBy('id', 'desc')->take(5)->get());
$view->with('tags', Tag::all());
});
}
开发者ID:mattvb91,项目名称:website-laravel,代码行数:10,代码来源:ViewComposerServiceProvider.php
示例19: run
public function run()
{
$article = Article::create(['title' => 'Lorem Ipsum Test', 'post_markdown' => '
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare rutrum purus nec luctus. Integer ultrices posuere justo. Sed tincidunt libero vel erat sodales, ac dapibus nibh efficitur. Mauris pulvinar felis id leo porta vestibulum. Pellentesque viverra semper sapien non ornare. Nam justo urna, vehicula vel iaculis eu, interdum quis tortor. Sed pretium quam ac condimentum condimentum. Integer a tincidunt nulla.
Aliquam interdum erat non tincidunt maximus. Maecenas venenatis facilisis neque non lobortis. Curabitur consectetur tellus risus, eu mattis orci consectetur id. Duis faucibus maximus accumsan. Cras ullamcorper neque magna, in ullamcorper dolor mollis ac. Aenean facilisis ultricies est, vel scelerisque arcu. Etiam viverra, ex in lacinia cursus, risus odio mollis lacus, id fringilla nisi mi quis ipsum. Nam rhoncus condimentum lobortis. Aliquam et ex odio. Etiam imperdiet dapibus sapien, id lobortis dolor feugiat eget.
Duis egestas volutpat velit, sit amet lobortis ipsum pharetra et. Aliquam erat volutpat. Vestibulum dictum massa non augue sagittis, nec tempor magna ornare. Mauris laoreet eros metus, sit amet interdum ligula suscipit ac. Nam porta accumsan sagittis. Fusce sed fermentum elit. Nulla pretium tortor neque, ut blandit nunc rutrum ac. Duis sed placerat eros. Vivamus et vestibulum felis, eu scelerisque dolor. Maecenas consequat et magna in posuere. Vestibulum sed ex at tortor luctus euismod. Nullam ultrices arcu vel ullamcorper scelerisque. Donec id euismod ipsum, interdum commodo dui. Praesent convallis felis sit amet vestibulum varius. Curabitur congue rhoncus lorem at aliquet. Praesent non magna ut leo tristique dignissim.
Donec in lacus sapien. Vivamus elit urna, venenatis et diam in, faucibus scelerisque libero. Suspendisse non libero magna. Phasellus molestie nulla nec diam venenatis, nec pretium augue aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo porttitor urna. Sed in varius turpis. Phasellus a condimentum odio. Curabitur eget elit gravida, consectetur ligula id, porta tortor. Pellentesque vel leo in purus lobortis elementum nec vitae odio. Mauris et faucibus dui. Donec sed velit ullamcorper, rutrum nulla id, elementum lorem. Ut pharetra ornare tortor ac consequat. Ut commodo magna vitae elit aliquam posuere.
Nunc interdum aliquet diam non imperdiet. Morbi sodales lectus sit amet volutpat efficitur. Vestibulum posuere condimentum diam, ut dapibus mi pulvinar vel. Etiam id arcu erat. Donec felis dui, imperdiet porta consequat quis, ultricies pellentesque libero. Curabitur at varius massa. Vivamus congue nisi orci, viverra pharetra nunc dictum eget. Aenean pharetra nibh eget pulvinar pellentesque. Nulla quis porttitor mauris, in pretium magna. In dolor erat, pretium vitae mauris at, congue mattis urna. Quisque fermentum tristique elit et condimentum.
Donec semper, purus id tempus tincidunt, justo massa luctus dui, sit amet viverra ante urna sed nisl. Nam sit amet tellus accumsan, fermentum mauris rhoncus, faucibus nisi. Aenean magna nibh, laoreet a rutrum at, egestas sed odio. Donec risus felis, pulvinar vitae metus et, convallis mattis felis. Quisque quis mauris ac odio pharetra congue eget sit amet nibh. Mauris eget laoreet massa, et semper lacus. Etiam nec tortor sem. Proin blandit ultrices nunc et feugiat. Fusce ornare mauris non nibh fermentum, at tempus nulla vehicula. Nulla aliquam felis et imperdiet suscipit. Aenean finibus dui tellus. Suspendisse convallis, metus id malesuada vestibulum, nibh tellus accumsan urna, porta accumsan mi elit et ante. Proin euismod convallis metus et porttitor. Fusce feugiat elementum nulla a rutrum.
Praesent sed imperdiet tellus. Etiam consectetur libero non est tempus, sit amet fermentum enim tristique. Maecenas suscipit tempus lectus ut ultricies. In ut commodo felis. Nulla vel magna id tortor rutrum varius. Nam id tincidunt leo, pretium vestibulum libero. Quisque malesuada ligula sed dolor tincidunt dignissim. Nulla volutpat mi ut lorem egestas, sed suscipit mi semper. Proin malesuada pellentesque massa sed rhoncus. Fusce et est ut purus auctor porttitor vitae vitae neque. Praesent at volutpat velit. Integer vel tempor dui. Sed ac tortor condimentum, volutpat tortor rutrum, porta nulla. Mauris rutrum arcu consequat, posuere est eget, lobortis nisl.', 'user_id' => '1']);
$article = Article::create(['title' => 'Lorem Ipsum Test 2', 'post_markdown' => ' ## Have some markdown!
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare rutrum purus nec luctus. Integer ultrices posuere justo. Sed tincidunt libero vel erat sodales, ac dapibus nibh efficitur. Mauris pulvinar felis id leo porta vestibulum. Pellentesque viverra semper sapien non ornare. Nam justo urna, vehicula vel iaculis eu, interdum quis tortor. Sed pretium quam ac condimentum condimentum. Integer a tincidunt nulla.
Aliquam interdum erat non tincidunt maximus. Maecenas venenatis facilisis neque non lobortis. Curabitur consectetur tellus risus, eu mattis orci consectetur id. Duis faucibus maximus accumsan. Cras ullamcorper neque magna, in ullamcorper dolor mollis ac. Aenean facilisis ultricies est, vel scelerisque arcu. Etiam viverra, ex in lacinia cursus, risus odio mollis lacus, id fringilla nisi mi quis ipsum. Nam rhoncus condimentum lobortis. Aliquam et ex odio. Etiam imperdiet dapibus sapien, id lobortis dolor feugiat eget.
Duis egestas volutpat velit, sit amet lobortis ipsum pharetra et. Aliquam erat volutpat. Vestibulum dictum massa non augue sagittis, nec tempor magna ornare. Mauris laoreet eros metus, sit amet interdum ligula suscipit ac. Nam porta accumsan sagittis. Fusce sed fermentum elit. Nulla pretium tortor neque, ut blandit nunc rutrum ac. Duis sed placerat eros. Vivamus et vestibulum felis, eu scelerisque dolor. Maecenas consequat et magna in posuere. Vestibulum sed ex at tortor luctus euismod. Nullam ultrices arcu vel ullamcorper scelerisque. Donec id euismod ipsum, interdum commodo dui. Praesent convallis felis sit amet vestibulum varius. Curabitur congue rhoncus lorem at aliquet. Praesent non magna ut leo tristique dignissim.
Donec in lacus sapien. Vivamus elit urna, venenatis et diam in, faucibus scelerisque libero. Suspendisse non libero magna. Phasellus molestie nulla nec diam venenatis, nec pretium augue aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo porttitor urna. Sed in varius turpis. Phasellus a condimentum odio. Curabitur eget elit gravida, consectetur ligula id, porta tortor. Pellentesque vel leo in purus lobortis elementum nec vitae odio. Mauris et faucibus dui. Donec sed velit ullamcorper, rutrum nulla id, elementum lorem. Ut pharetra ornare tortor ac consequat. Ut commodo magna vitae elit aliquam posuere.
Nunc interdum aliquet diam non imperdiet. Morbi sodales lectus sit amet volutpat efficitur. Vestibulum posuere condimentum diam, ut dapibus mi pulvinar vel. Etiam id arcu erat. Donec felis dui, imperdiet porta consequat quis, ultricies pellentesque libero. Curabitur at varius massa. Vivamus congue nisi orci, viverra pharetra nunc dictum eget. Aenean pharetra nibh eget pulvinar pellentesque. Nulla quis porttitor mauris, in pretium magna. In dolor erat, pretium vitae mauris at, congue mattis urna. Quisque fermentum tristique elit et condimentum.
Donec semper, purus id tempus tincidunt, justo massa luctus dui, sit amet viverra ante urna sed nisl. Nam sit amet tellus accumsan, fermentum mauris rhoncus, faucibus nisi. Aenean magna nibh, laoreet a rutrum at, egestas sed odio. Donec risus felis, pulvinar vitae metus et, convallis mattis felis. Quisque quis mauris ac odio pharetra congue eget sit amet nibh. Mauris eget laoreet massa, et semper lacus. Etiam nec tortor sem. Proin blandit ultrices nunc et feugiat. Fusce ornare mauris non nibh fermentum, at tempus nulla vehicula. Nulla aliquam felis et imperdiet suscipit. Aenean finibus dui tellus. Suspendisse convallis, metus id malesuada vestibulum, nibh tellus accumsan urna, porta accumsan mi elit et ante. Proin euismod convallis metus et porttitor. Fusce feugiat elementum nulla a rutrum.
Praesent sed imperdiet tellus. Etiam consectetur libero non est tempus, sit amet fermentum enim tristique. Maecenas suscipit tempus lectus ut ultricies. In ut commodo felis. Nulla vel magna id tortor rutrum varius. Nam id tincidunt leo, pretium vestibulum libero. Quisque malesuada ligula sed dolor tincidunt dignissim. Nulla volutpat mi ut lorem egestas, sed suscipit mi semper. Proin malesuada pellentesque massa sed rhoncus. Fusce et est ut purus auctor porttitor vitae vitae neque. Praesent at volutpat velit. Integer vel tempor dui. Sed ac tortor condimentum, volutpat tortor rutrum, porta nulla. Mauris rutrum arcu consequat, posuere est eget, lobortis nisl.', 'user_id' => '1']);
}
开发者ID:samuraiseoul,项目名称:laravelBlog,代码行数:33,代码来源:ArticleTableSeeder.php
示例20: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 100; $i++) {
Article::create(['name' => $faker->name, 'description' => $faker->sentence(10), 'content' => $faker->text(200), 'author' => $faker->numberBetween(1, 10)]);
}
}
开发者ID:hramose,项目名称:laravel-5-admin,代码行数:7,代码来源:ArticlesTableSeeder.php
注:本文中的app\models\Article类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论