예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $headline1 = new \App\Headline(['vendor_id' => 0, 'active_since' => '2015-09-01', 'active_until' => '2015-12-30', 'title' => 'About Capcus', 'link_to' => 'http://localhost:8000/tour', 'priority' => 1]);
     $headline1->save();
     $headline1->images()->saveMany([new \App\Image(['path' => 'http://localhost:8000/images/sliders/slider2.jpg', 'name' => 'LargeImage', 'title' => 'About Capcus', 'description' => ''])]);
 }
예제 #2
0
 public function testConvertsUrlToEmbed()
 {
     $youtubeUrl = 'https://www.youtube.com/watch?v=rDdKNt-CvXA&list=FLmgvpKJEyvjJ7-n6PNl6_aQ&index=6';
     $headline = new App\Headline();
     $headline->save();
     $attachment = new App\Attachment(['type' => 'youtube', 'link' => $youtubeUrl]);
     $headline->attachment()->save($attachment);
     $expected = '<iframe class="embed-responsive-item" width="560" height="315" src="https://www.youtube.com/embed/rDdKNt-CvXA" allowfullscreen></iframe>';
     $this->assertEquals($expected, $attachment->embedCode());
 }