iNemesis247

Experience

760

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

10th March, 2018

iNemesis247 started a new conversation ReactJS Build Components • 3 months ago

How do i get this to work?

createElements(o) {
        const element = (
            <ExpansionPanel>
                <ExpansionPanelSummary>
                    title
                </ExpansionPanelSummary>
                <ExpansionPanelDetails>
                    text
                </ExpansionPanelDetails>
            </ExpansionPanel>
        );
        for(let i = 0; i < o.length; i++) {
            document.getElementById('depository').append(element);
        }
    }

So far i got printed on my screen [object Object]

28th December, 2017

iNemesis247 left a reply on Laravel Files Request Error • 5 months ago

@shez1983 how do i roll back to 7.1 on homestead ?

iNemesis247 started a new conversation Laravel Files Request Error • 5 months ago

I have a form :

<form action="/savePosts" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}
        <input type="file" name="files[]" multiple required>
        <button class="btn waves-effect waves-light red" type="submit" name="submit">Δημοσίευση</button>
</form>

Then i have a controller :

namespace App\Http\Controllers;

use File;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Requests\UploadRequest;
use Illuminate\Support\Facades\Storage;

class savePosts extends Controller
{
    public function index (UploadRequest $request) {
        ini_set('memory_limit', '1024M');
        foreach($request->fs as $file) {
                // Do something here
            }
    }
}

And finally the UploadRequest.php file :

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UploadRequest extends FormRequest
{
    /**
    * Determine if the user is authorized to make this request.
    *
    * @return bool
    */
        public function authorize()
        {
            return true;
        }

        /**
        * Get the validation rules that apply to the request.
        *
        * @return array
        */
    public function rules()
        {
            $files = count($this->input('files'));
            foreach(range(0, $files) as $index) {
                    $rules['files.' . $index] = 'file|mimes:jpeg,png,mpeg,mpga,mp3,mp4,doc,docx,odt,rtf,xls,xlsx,ods,ppt,pptx,odp,txt,pdf|max:10000000000';
            }
            return $rules;
        }
}

But whenever i submit the form i get this error :

count(): Parameter must be an array or an object that implements Countable

What am i doing wrong ?

16th December, 2017

iNemesis247 left a reply on Laravel/Homestead Database • 6 months ago

@petrit Well first i want to define something. Do i need to install MySQL server 5.7 or just apache's installation of MySQL ?

iNemesis247 started a new conversation Laravel/Homestead Database • 6 months ago

So i installed homestead and configured my .env file for a connection to my database. I set up a MySQL connection for homestead as i found on a YouTube tutorial. Then i migrated the database and when i opened MySQL workbench the database's tables were there. When i try to make a query to that database i get SQLSTATE[HY000][1045] Access denied for user 'user'@'localhost' (using password:YES) . Does that make any sense? I mean, the migration succeeded with no errors etc and access is denied when i try to make a query?

6th November, 2017

iNemesis247 left a reply on Custom Javascript Image Modal! • 7 months ago

@mushood Thank you so much !!

5th November, 2017

iNemesis247 started a new conversation Custom Javascript Image Modal! • 7 months ago

I created a custom image modal for a gallery i have.

@foreach($file as $image)
    <a onclick="previewImage('{{ $image }}')">
        <img class="thumbnail" src="{{ $image }}">  
    </a>
@endforeach

That is the modal i made.

<div id="imageBox" class="imageBox">
    <div class="content">
        <div class="body">
            <img id="im2prev" style="max-height:90vh;max-width:100%" src="" alt="">
        </div>
        <div class="foot">
        
        </div>
    </div>
</div>

And that is the javascript code for opening up modal.

function previewImage(image){
        var imageBox = document.getElementById('imageBox');
        var src = document.getElementById('im2prev');
        src = image;
        imageBox.style.display = "block";
    }
    window.onclick = function(event) {
        if (event.target == imageBox) {
            imageBox.style.display = "none";
        }
    }

Now i need to have a Next / Previous button at the modal's .foot. But how am i going to point on which image is the next and the previous one ?

4th November, 2017

iNemesis247 left a reply on Storage Limit Returns! • 7 months ago

@robrogers3 Yes. I know how to keep track of things like that. I just didn't know if it was possible somehow. But since there is a way through my database i will go with it. So thank you for your time. I really appreciated it!

iNemesis247 left a reply on Storage Limit Returns! • 7 months ago

@robrogers3 Yes i do store files' attributes to database and sounds like a good idea. I'll try it and let you know. But what do you mean by doing 10 at a time as the user scrolls?

iNemesis247 left a reply on Storage Limit Returns! • 7 months ago

@robrogers3 Hahaha so i guess it's not possible yet !

iNemesis247 started a new conversation Storage Returns! • 7 months ago

So i wanted to create an infinite scroll in a laravel project.

So far i have Storage::disk('s3')->allFiles(pathToFiles); and it works fine. But i need something like SELECT * FROM 'table' LIMIT 10,0 so the next time someone scrolls down it will be SELECT * FROM 'table' LIMIT 10,10 . Is something like that possible with Storage... ? I found nothing on Laravel's documentation.

Thanks!

26th October, 2017

iNemesis247 started a new conversation Storage All Files Issue • 7 months ago

I have a folder called "Images" and inside it a folder called "thumbs".

If i do Storage::disk('s3')->allFiles('Images') it returns even the images stored inside "thumbs".

How can you handle this ? i want to get only the images inside "Images" folder.

25th October, 2017

iNemesis247 left a reply on Call A Method Inside The Same Method! • 7 months ago

@martinbean Well there is a gallery with images and folders. This class is used to delete the images, but when it comes to deleting the whole folder i need to check if the incoming request is a folder and not an image. If this is true then call the function to delete the images inside a foreach.

iNemesis247 started a new conversation Call A Method Inside The Same Method! • 7 months ago

Is this possible ?

<?php

namespace App\Http\Controllers;

class ThisClass extends Controller
{
    public function ThisFunc($thisParam)
    {
        if($something == true){
            ThisFunc(true);
        }
    }
}

?>

So far the above code is not working.

8th October, 2017

iNemesis247 left a reply on Tasks Running In Background • 8 months ago

@ftrillo I'll check this and see if i can get anything out of it. Thanks for your reply

iNemesis247 started a new conversation Tasks Running In Background • 8 months ago

I don't know if it makes any sense, but i will give an example so us to make it clear. Let's say i want people that uses my website, to be able to upload gigas of data. Can i catch this event and run it in the background while the user navigates through the website doing other stuff? So far when i upload a 1gb file (using ajax), if i refresh or go to another page the upload is interrupted. I believe it is possible but i need help on what needs to be done.

7th October, 2017

iNemesis247 left a reply on Ajax Upload Files / Progress Bar • 8 months ago

@Dry7 Thank you. Really appreciated it.

iNemesis247 started a new conversation Ajax Upload Files / Progress Bar • 8 months ago

Hello. I want to create a nice upload UI and i need help. So far i use ajax for uploading and my code is :

app.js

var form = document.getElementById('upload');
var request = new XMLHttpRequest();

form.addEventListener('submit', function (e) {
    e.preventDefault();
    var formdata = new FormData(form);
    request.open('post', '/upload');
    request.addEventListener("load", transferCompleted);
    request.send(formdata);
});

function transferCompleted(data){
    console.log('Upload Completed');
}

UploadRequest.php (Where i check mimes etc)

// Rules method
public function rules()
    {
       // Check mimes
        return $rules;
    }
}

and finally UploadFilesController.php

...
// Routed method uploadSubmit
public function uploadSubmit(UploadRequest $request)
{
    // Store Files
    return view('thisview', $aMessage);
}

All i want now is to set a simple progress bar to proceed further building a nice UI. Any suggestions on how you do this ?

Thanks.

5th October, 2017

iNemesis247 started a new conversation Preview Word, Excel And Powerpoint Documents. • 8 months ago

I'm new to Laravel and i'm currently trying to figure out how things work. So far so good (credits to the awesome Laravel documentation). So this is a more general question, than PHP/Laravel. I uploaded docs to my laravel project. Word, Excel, Powerpoint and PDF. So foreach file, i have

<a href="path/to/doc">
    <iframe src="path/to/doc"/>
</a>

When i click the PDF file it opens up nicely to preview. But for Word, Excel, Powerpoint (office) that won't happen. Instead when the page loads or when i press upon the link, the download window pops up. After hours of digging i found the PHPOffice Library but after reading the description i'm not sure that it could do what i want. So my question is, is there any PHP/Laravel library/extension/tool or whatever so as to nicely preview office documents in the browser like PDFs ?

Thanks in advance!

25th September, 2017

iNemesis247 left a reply on Laravel Routing, Getting Anything Behind A Slash! • 8 months ago

Both said the same thing. It worked. Thank you for your time !!

iNemesis247 left a reply on Laravel Routing, Getting Anything Behind A Slash! • 8 months ago

@ejdelmonico Yes i've tried asterisk but returns the "Page Not Found"

iNemesis247 started a new conversation Laravel Routing, Getting Anything Behind A Slash! • 8 months ago

I'm new in Laravel although i've been using PHP quite a while. I searched this question everywhere but didn't get any answer.

Is it possible to have something like this?

Route::get('[IF exists, get anything before this slash ->]/view/{var}', function ($var) { $data = array('variable'=>$var); return view('thisview'); });

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.