jerauf

Experience

730

0 Best Reply Awards

  • Member Since 3 Years Ago
  • 2 Lessons Completed
  • 0 Favorites

18th November, 2017

jerauf started a new conversation BaseURI? • 6 days ago

I'm getting an error "You must provide a baseURI variable" when going to a simple route with an insert statement.

I've got the app URL set in my env file and config/app.php.

What does this error mean?

14th November, 2017

jerauf started a new conversation Reload Area Of The Page Based On Database Insert • 1 week ago

I want to create a realtime activity feed on my site but uncertain about where to start.

I've got a div on my page that is for new activity. When someone adds a record to the database, I want a notification to appear in this div without the user reloading.

Can someone give me some advice on how to achieve this? Events? Listeners? Vue? Ajax? Not even sure.

6th October, 2017

jerauf left a reply on Inserting Multiple Records At Once • 1 month ago

Your edit worked. Thank you @Parasoul!

jerauf left a reply on Inserting Multiple Records At Once • 1 month ago

$import is not in the array. I only use it to find the record to import in Import.

$publish_on is randomly included. Some yes, some no.

jerauf started a new conversation Inserting Multiple Records At Once • 1 month ago

I know this has been covered but the solutions on Laracasts and Stack Overflow haven't worked for me and I'm not sure why.

I want to use check boxes to indicate which results to import, set a publish date and insert into a MySQL database.

Here is my form:

        <form class="ui form" method="post" action="{{ route('importLanguageSave') }}" enctype="multipart/form-data">


            <div class="ui six cards">
            
                @foreach($languages as $language)
                
                    <div class="card">
                        <div class="image">
                            <img src="language_icon">
                        </div>
                        <div class="content">
                            <div class="ui checkbox">
                                <input type="checkbox" name="import[]" value="{{ $language->id }}"> <label>Import</label>
                            </div>
                            
                            <div class="field">
                                <label>Publish Date</label>
                                <input type="date" name="publish_on[]">
                            </div>
                        </div>
                        
                        
                    </div>
                
                @endforeach
            
            </div>
            <button class="ui button" type="submit">Import</button>
            
            {{ csrf_field() }}
        </form>

And here is my controller:

    $input = $request->all();
    $import = $input['import'];
    $publish_on = $input['publish_on'];
    
    foreach($import as $key => $n) 
    {
        $import_img = Import::find($import[$key]);
        
        
    
        $arrData[] = array( 
            "language_id"   => $import_img->id, 
            "publish_on"    => $publish_on[$key],
            "created_by_id" => Auth::user()->id,                
            "updated_by_id" => Auth::user()->id,
            "created_at"    => Carbon::now(),
            "updated_at"    => Carbon::now(),
        );
    
    }   

            Language::insert($arrData);

The problem I'm having is that $publish_on is randomly displaying as null after insert. It inserts the correct number of records.

Any ideas?

19th September, 2017

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

I figured it out. The php.ini file that the server was loading was the wrong one.

Thank you @Snapey, @sutherland, and @Waldemar for the help.

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

@jlrdw - I think you may have misread my post. I want no constraints in terms of size or ratio. That's the problem.

@Snapey & @sutherland - I removed everything from my log file. Tried to upload an image that's 2000x3000px, got the error. But nothing was added to my log file. In my browser, I just get a standard error page that says:

domain.com is currently unable to handle this request.
HTTP ERROR 500

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

I've gotten it to store the files in storage/public. The files are being uploaded. It gives a 500 error every time Laravel Media Library tries to resize an image larger than 1500px high.

Here is the last line from my error log.

#46 /xx/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

Why is everyone getting so short with me? This is a frustrating situation. That wasn't a constructive answer.

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

It has nothing to do with uploading the file. It has to do with Laravel Media Library not able to handle images that size.

17th September, 2017

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

I commented all of the lines out of htaccess in the root of my server and placed your above suggestion there. I got the 500 Internal Server Error. I also tried the one in Laravel's public folder. Same thing. Didn't comment anything out there.

With regard to permissions, if I didn't have permission, I wouldn't be able to upload at all, though. Right? I only get the error for files larger than 1500px.

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

When I add that the my .htaccess file in the root of my server, I get a 500 error.

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

Sure. I have two forms. One for uploading:

    <form action="file/save" method="post" enctype="multipart/form-data" target="_top">
    
        {{-- start: Poster --}}
        <label>Poster from File
            <input type="file" name="poster_file" id="poster_file">
        </label>
        {{-- end: Poster --}}
        
        <button>Replace image</button>
        
        <input type="hidden" name="movie_id" value="{{ $movie->id }}">
        {{ csrf_field() }}
        
    </form>

And, one for getting an image from web:

    <form action="web/save" method="post" target="_top">
        
        <input type="text" name="poster_url">
        
        <button>Refresh image</button>
        
        <input type="hidden" name="movie_id" value="{{ $movie->id }}">
        {{ csrf_field() }}
        
    </form>

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

In the log, there are about 50 entries. Multiple errors in Pipeline and Routes. There's one in Illuminate/Foundation/Http/Middleware/ValidatePostSize. I thought that might be one to look at. But the file doesn't exist.

@Waldemar - Thank you. I updated those parameters. Still having the problem.

16th September, 2017

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

All of the settings on the server are such that it wouldn't restrict the px dimensions of an image.

jerauf left a reply on Uploading Large Dimension Files • 2 months ago

@Waldemar - It's Apache.

jerauf started a new conversation Uploading Large Dimension Files • 2 months ago

Is there a setting to limit the px dimensions of an uploaded file?

I'm using spatie Laravel Media Library. They say that there's no setting to limit this. My php.ini file has 5mb as the max upload size. But when I try to upload an image that's larger than 1500px, I get a 500 error.

14th September, 2017

jerauf left a reply on Store() Isn't Uploading A File • 2 months ago

Same result after doing that and going to domain.com/storage/app/uploads/8UpdkvL3QsiDu3oh3qILd9GO7Exhtpm9IgnnnUUr.jpeg

jerauf left a reply on Store() Isn't Uploading A File • 2 months ago

However, when I try to access the file, I'm given an error:

 File `storage/app/uploads/8UpdkvL3QsiDu3oh3qILd9GO7Exhtpm9IgnnnUUr.jpeg` does not exist

jerauf left a reply on Store() Isn't Uploading A File • 2 months ago

They're there! In storage/app/uploads

Thank you.

jerauf left a reply on Store() Isn't Uploading A File • 2 months ago

Sure. It's:

 Array ( [file_name] => Array ( [name] => the_big_w.jpg [type] => image/jpeg [tmp_name] => /tmp/php7wwiqj [error] => 0 [size] => 190115 ) )

jerauf left a reply on Store() Isn't Uploading A File • 2 months ago

@Dry7 -

Yeah, my form is:

    <form action="{{ route('saveFile') }}" method="post" enctype="multipart/form-data">
    
    <input type="file" name="file_name">
    
    <p><button type="submit">Upload</button>
    
    {{ csrf_field() }}
    
    </form>

jerauf started a new conversation Store() Isn't Uploading A File • 2 months ago

I've got this code from my file upload form.

    $file_name = $request->file('file_name');
            
    $path = $request->file('file_name')->store('uploads');

The uploads folder is set to read/write access 777. If I return $path, it gives me the right path and the new name of the file. But the file isn't on me server.

I've also tried:

     $path = Storage::putFile('uploads', $request->file('file_name'));

That hasn't worked either.

What am I doing wrong?

11th August, 2017

jerauf started a new conversation WithDefault For HasOne? • 3 months ago

Does withDefault() work with a hasOne relationship? I haven't been able to get it to work.

6th July, 2017

jerauf left a reply on [05-Jul-2017 23:46:09 America/Los_Angeles] PHP Fatal Error: Class 'Route' Not Found In [My Path]/routes/Forwards/forwarded.php On Line 2 • 4 months ago

In web.php, I'm referencing like this.

foreach (File::allFiles(DIR.'/Forwards') as $partial) { require_once $partial->getPathname(); }

This error has randomly showed up. The site was fine on the 4th. Then yesterday, this happened.

jerauf left a reply on [05-Jul-2017 23:46:09 America/Los_Angeles] PHP Fatal Error: Class 'Route' Not Found In [My Path]/routes/Forwards/forwarded.php On Line 2 • 4 months ago

Just routes. It starts with <?php. I checked the Laravel docs and they're just normal routes.

jerauf started a new conversation [05-Jul-2017 23:46:09 America/Los_Angeles] PHP Fatal Error: Class 'Route' Not Found In [My Path]/routes/Forwards/forwarded.php On Line 2 • 4 months ago

I keep getting this error at the top of my screen and can't figure out where the problem lies. The mention of Los Angeles is puzzling because my app time zone is set to New York.

This references an outside file that's not part of my routes file. I tried a dump auto-load along with clearing the cache. It gives me the same error in terminal.

Can anyone help? All of this appears at the top of every screen in my app.

6th May, 2017

jerauf started a new conversation Sorting With Jquery UI • 6 months ago

I'm trying to sort with Jquery UI and it's giving me fits.

Here is my controller:

public function postSortSongs(Request $request)
{
    $i = 1;

    foreach ($request->list_order as $value) {
        $i++;
        Songs::where('id', '=', $value)->update(['sort_no' => $i]);
    }
}

Here's my Javascript:

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script>
    var getXsrfToken = function () {
        var cookies = document.cookie.split(';');
        var token = '';

        for (var i = 0; i < cookies.length; i++) {
            var cookie = cookies[i].split('=');
            if (cookie[0] == 'XSRF-TOKEN') {
                token = decodeURIComponent(cookie[1]);
            }
        }

        return token;
    };
    $.ajaxSetup({
        headers: {
            'X-XSRF-TOKEN': getXsrfToken()
        }
    });

    $(document).ready(function(){
        $('#sortable').sortable({
            axis: 'y',
            opacity: 0.7,
            update: function(event, ui) {
                var data = $(this).sortable('serialize');

                $.ajax({
                    url: '{{ route('show_sort_songs_save') }}',
                    type: 'POST',
                    data: data
                });
            }
        });
    });
</script>

Here is my view:

        <ul id="sortable">
            
            @foreach($songs as $song)
                <li id="item-{{ $song->id }}">{{ $song->title_of_song->song_title }}</li>
            @endforeach
            
        </ul>

And I'm getting an internal 500 error:

send @ jquery.js:26 ajax @ jquery.js:25 update @ main:148 _trigger @ jquery-ui.min.js:6 _trigger @ jquery-ui.min.js:12 (anonymous) @ jquery-ui.min.js:6 (anonymous) @ jquery-ui.min.js:12 _clear @ jquery-ui.min.js:12 (anonymous) @ jquery-ui.min.js:6 _mouseStop @ jquery-ui.min.js:12 (anonymous) @ jquery-ui.min.js:6 _mouseUp @ jquery-ui.min.js:6 (anonymous) @ jquery-ui.min.js:6 n._mouseCapture._mouseDistanceMet._mouseDelayMet._mouseUpDelegate @ jquery-ui.min.js:6 dispatch @ jquery.js:25 q.handle @ jquery.js:24

Can anyone help me? I've looked all over the web and can't find a solution that can help me.

27th April, 2017

jerauf left a reply on TokenMismatchException In VerifyCsrfToken.php Line 68 • 6 months ago

I thought of that. And there are files being created there.

jerauf started a new conversation TokenMismatchException In VerifyCsrfToken.php Line 68 • 6 months ago

I've seen many posts around the web about this but none of the solutions have worked. I have a new installation of Laravel and am putting a site back up. When I add only my views, my own controllers, etc (not adding any packages or doing anything but adding database credentials) I get the above token mismatch error. When I try logging in in incognito mode in Chrome, it just refreshes the login page.

I've tried commenting out the CRSF line in kernel.php, changing the write permissions to the sessions folder, and many other things.

Nothing is working. Has anyone had this trouble?

23rd April, 2017

jerauf left a reply on Socialite InvalidStateException Since Updating To 5.4.18 • 7 months ago

Yeah. I did.

jerauf started a new conversation Socialite InvalidStateException Since Updating To 5.4.18 • 7 months ago

I updated to the latest version of Laravel last week and now I'm having problems with social login using Socialite.

I'm getting this error:

InvalidStateException in AbstractProvider.php line 200

I've searched on the web and found a few things. Fixed them. But am still having the problem. Has anyone run into this?

Edit Your Profile
Update

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