public function run() { App\Article::create(["title" => "first article", "body" => "first article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]); App\Article::create(["title" => "second article", "body" => "second article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]); App\Article::create(["title" => "third article", "body" => "third article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]); App\Article::create(["title" => "a future article", "body" => "a future article body", "published_at" => Carbon\Carbon::now()->addDays(8), "user_id" => 1]); App\Article::create(["title" => "another future article", "body" => "another future article body", "published_at" => Carbon\Carbon::now()->addDays(18), "user_id" => 1]); }
var_dump($art->title); } return; /* CREATING NEW ARTICLES */ $article3 = App\Article::create(array('title' => 'How to ride a bike', 'body' => '...')); return; // second way (never a mass-assignment alert if done this way) $article2 = new App\Article(); $article2->title = 'How to be succesful!'; $article2->body = 'This is some other body...'; $article2->save(); return 'Saved article. It has an id of ' . $article2->id; // first way $article = App\Article::create(array('title' => 'How to peel potatoes', 'body' => 'This is some body...')); return $article->id; }); Route::get('article', function () { $article = new App\Article('How to peel a potato'); $letter = 'o'; if ($article->containsLetter($letter)) { return 'Contains: ' . $letter; } return 'Nope'; }); /************************************************************************************/ Route::get('conditional', function () { $list = array('Harry', 'Ron', 'Hermione'); return View::make('hello')->withFriends($list); });
public function run() { App\Article::create(['title' => 'How to ride a bike', 'body' => '...']); App\Article::create(['title' => 'Potetos peeling 4 beginers', 'body' => '...']); }