Пример #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $series = $this->argument('series');
     $data = json_decode($this->filesystem->get(base_path('resources/assets/json/' . $series . '_full.json')));
     $series = $this->series->create((array) $data);
     $this->db->table('cards')->whereNull('series_id')->update(['series_id' => $series->id]);
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $faker = Faker\Factory::create();
     foreach (range(1, 10) as $index) {
         Series::create(['name' => $faker->name, 'description' => $faker->sentence(), 'count' => $faker->randomDigit()]);
     }
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(SeriesRequest $request, $society)
 {
     $series = Series::create($request->all());
     if ($request->file('seriesimage')) {
         $fileName = "seriesimage_" . $series->id . "." . $request->file('seriesimage')->getClientOriginalExtension();
         $request->file('seriesimage')->move(base_path() . '/storage/app/images/', $fileName);
         $series->seriesimage = '/storage/app/images/' . $fileName;
         $img = Image::make(base_path() . $series->seriesimage);
         $img->resize(250, 250);
         $img->save(base_path() . '/storage/app/images/' . $fileName);
     }
     if ($request->file('seriesbanner')) {
         $fileName = "seriesbanner_" . $series->id . "." . $request->file('seriesbanner')->getClientOriginalExtension();
         $request->file('seriesbanner')->move(base_path() . '/storage/app/images/', $fileName);
         $series->seriesbanner = '/storage/app/images/' . $fileName;
     }
     $series->save();
     return redirect(url('/') . '/' . $series->society_id . '/series')->with('okmessage', 'New series has been added');
 }