Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($request->hasFile('image1')){
- // Get filename with the extension
- $filenameWithExt = $request->file('image1')->getClientOriginalName();
- // Get just filename
- $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
- // Get just ext
- $extension = $request->file('image1')->getClientOriginalExtension();
- // Filename to store
- $fileNameToStore= $filename.'_'.time().'.'.$extension;
- // Upload Image
- $path = $request->file('image1')->storeAs('public/cover_images', $fileNameToStore);
- } else {
- $fileNameToStore = 'noimage.jpg';
- }
- public function up()
- {
- Schema::table('images', function ( $table) {
- $table->string('image1');
- $table->string('image2');
- $table->string('image3')->nullable();
- $table->string('image4')->nullable();
- $table->string('image5')->nullable();
- $table->string('image6')->nullable();
- $table->string('image7')->nullable();
- $table->string('image8')->nullable();
- $table->string('image9')->nullable();
- $table->string('image10')->nullable();
- $table->string('image11')->nullable();
- $table->string('image12')->nullable();
- $table->string('image13')->nullable();
- $table->string('image14')->nullable();
- $table->string('image15')->nullable();
- $table->string('image16')->nullable();
- });
- }
Add Comment
Please, Sign In to add comment