Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $imgPath = 'img/uploads/';
     $timestamp = time();
     $fileProperties = ['img_artwork', 'img_signature', 'img_optional'];
     foreach ($fileProperties as $fileProperty) {
         if ($request->hasFile($fileProperty)) {
             $file = $request->file($fileProperty);
             $extension = $file->getClientOriginalExtension();
             $randomstring = self::generateRandomString(20);
             $filename = $timestamp . '-' . $randomstring . '.' . $extension;
             $file->move($imgPath, $filename);
             $input[$fileProperty] = '/' . $imgPath . $filename;
         }
     }
     $input['enddate'] = Carbon::createFromFormat('Y-m-d', $input['enddate']);
     $auction = Auction::create($input);
     $owner = Auth::user();
     $auction->owner()->associate($owner);
     $style = AuctionStyle::findOrFail($request->get('auction_style_id'));
     $auction->auctionstyles()->associate($style);
     $auction->save();
     return redirect()->route('myauctions');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('auction_styles')->delete();
     $styles = ['Abstract', 'African American', 'Asian Contemporary', 'Conceptual', 'Contemporary', 'Emerging Artists', 'Figurative', 'Middle Eastern Contemporary', 'Minimalism', 'Modern', 'Pop', 'Urban', 'Vintage Photographs'];
     foreach ($styles as $style) {
         AuctionStyle::create(['name' => $style]);
     }
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('auctions')->delete();
     $owner = User::first();
     $style_first = AuctionStyle::first();
     $style_random = AuctionStyle::orderByRaw("RAND()")->first();
     Auction::create(['owner_id' => $owner->id, 'auction_style_id' => $style_first->id, 'title' => 'La trahison des images - René Magritte', 'year' => 1928, 'width' => '63.5', 'height' => '93.98', 'depth' => null, 'description' => 'The Treachery of Images (sometimes translated as The Treason of Images) is a painting by the Belgian surrealist painter René Magritte.', 'condition' => 'Great', 'origin' => 'Belgium', 'img_artwork' => '/img/uploads/magritte_1.jpg', 'img_signature' => '/img/uploads/magritte_2.png', 'img_optional' => null, 'min_price' => '20000', 'max_price' => '1000000', 'buyout_price' => '1000000', 'enddate' => Carbon::parse('last wednesday')->format('Y-m-d')]);
     Auction::create(['owner_id' => $owner->id, 'auction_style_id' => $style_random->id, 'title' => 'Skrik - Edvard Munch', 'year' => 1893, 'width' => '91', 'height' => '73.5', 'depth' => null, 'description' => 'The Scream (Norwegian: Skrik) is the popular name given to each of four versions of a composition, created as both paintings and pastels, by the Expressionist artist Edvard Munch between 1893 and 1910. The Greman title Munch gave these works is Der Schrei der Natur (The Scream of Nature). The works show a figure with an agonized expression against a landscape with a tumultuous orange sky. Arthur Lubow has described The Scream as "an icon of modern art, a Mona Lisa for our time."', 'condition' => 'Okay', 'origin' => 'Oslo', 'img_artwork' => '/img/uploads/scream_1.jpg', 'img_signature' => '/img/uploads/scream_2.jpg', 'img_optional' => '/img/uploads/scream_3.jpg', 'min_price' => '7500', 'max_price' => '1355000', 'buyout_price' => '1000000', 'enddate' => Carbon::parse('next saturday')->format('Y-m-d')]);
     for ($i = 0; $i < 50; $i++) {
         Auction::create(['owner_id' => $owner->id, 'auction_style_id' => $style_random->id, 'title' => 'FILLER ' . $i, 'year' => rand(1000, 2000), 'width' => rand(10, 100), 'height' => rand(10, 100), 'depth' => null, 'description' => "FILLER DESCRIPTION Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", 'condition' => 'Fine', 'origin' => 'World', 'img_artwork' => '/img/uploads/filler_' . rand(1, 8) . '.jpg', 'img_signature' => '/img/uploads/filler_' . rand(1, 8) . '.jpg', 'img_optional' => null, 'min_price' => rand(100, 1000), 'max_price' => rand(2000, 20000), 'buyout_price' => 20000, 'enddate' => Carbon::parse('next thursday')->format('Y-m-d')]);
     }
 }