futureperfect90

futureperfect90

Member Since 4 Months Ago

Experience Points 70
Experience Level 1

4,930 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

15 Mar
4 months ago

futureperfect90 left a reply on Throw New MethodNotAllowedHttpException($others)

@SCREENBEETLE - Thanks for getting back to me, tbh the only reason that the patch is in there is because someone said i might work but didn't anyway and just not removed it. Yeah i think thats what it is going to come to and just rewrite and go from there

14 Mar
4 months ago

futureperfect90 started a new conversation Throw New MethodNotAllowedHttpException($others)

Hello Guys,

I am trying to update a field but want to check if the field is empty, if the field has something in it then everything is fine and updates successfully, however if the field is blank then i get:

 throw new MethodNotAllowedHttpException($others)

I have looked everywhere and everyone says its because i am posting to a get request however this is not the case as when the field has data in its fine. For my routes i am using route::Resource and have used this on other edit pages and it works fine just not on this page. All i want is the validation to come up saying that this field is required which works if i go back from the error page and it displays at the top. I'm at my wits end and don't know what it is. Someone help!

My Routes:

Route::resource('observations', 'ObservationsController');

My Blade:

@extends('layouts.app')
@section('title', 'Update Observation')
@section('content')
    <div class='col-lg-4 col-lg-offset-4'>
        <h2><i class='fa fa-key'></i>Update Observation</h2>
        <hr>
        {{--Form model binding to automatically populate our fields with observation data--}}
        {{ Form::model($childObservation, ['route' => ['observations.update', $childObservation->_id], 'method' => 'POST', 'files' => true]) }}
        {{method_field('PATCH')}}
        <table>
            {{Form::hidden('Observation', json_encode($selectedOb))}}
            @foreach($selectedOb as $observation)
                @foreach($observation as $categoryNameKey => $categoryNameValue)
                    <tr><td><h3><b>Observation Category</b></h3></td></tr>
                    <tr><td><h4>{{$categoryNameKey}}</h4></td></tr>
                    <tr><td>&nbsp;</td></tr>
                    @foreach($categoryNameValue as $subCatKey => $subCat)

                        <tr><td><b>Observation Sub Category</b></td></tr>
                        <tr><td>{{$subCatKey}}</td></tr>
                        <tr><td>&nbsp;</td></tr>
                        @foreach($subCat as $ageKey => $statement)
                            <tr><td><b>Observation Age Range</b></td></tr>
                            <tr><td>{{$ageKey}}</td></tr>
                            <tr><td>&nbsp;</td></tr>
                            <tr><td><b>Observation Statements</b></td></tr>
                            <tr><td>{{$statement}}</td></tr>
                        @endforeach

                        <tr><td>&nbsp;</td></tr>
                        <tr><td><b>Stage</b></td></tr>
                        <tr>
                            <td>
                                {{Form::select('Stage[]', array('Ent' => 'Entry', 'Dev' => 'Developing', 'Sec' => 'Secure'), ['class' => 'form-control']) }}
                            </td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr><td><b>Level</b></td></tr>
                        <tr>
                            <td>
                                {{Form::select('Level[]', array('1' => '1', '2' => '2', '3' => '3'), ['class' => 'form-control']) }}
                            </td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr><td><hr></td></tr>

                    @endforeach

                @endforeach
            @endforeach
            <tr><td>{{Form::label('ObservationNotes', 'Observation Notes')}}</td></tr>
            <tr><td>{{Form::textarea('ObservationNotes', $childObservation->ObservationNotes, ['class' => 'form-control'])}}</td></tr>
            <tr><td>&nbsp;</td></tr>
            <tr><td>{{Form::label('CurrentImages', 'Current Images')}}</td></tr>
            @if ($childObservation->UploadImage != null)
                @foreach($childObservation->UploadImage as $images)
                <tr><td><img class="imageSize" src ="{{asset('storage/'.$images)}}"></td></tr>
                @endforeach
                @else <tr><td><p>No Images Stored.</p></td></tr>
            @endif
            <tr><td>{{Form::label('ImageUpload', 'Upload Image')}}</td></tr>
            <tr><td>{{Form::file('ImageUpload[]', ['multiple'=>true])}}</td></tr>
            <tr><td>&nbsp;</td></tr>
        </table>
        {{ Form::submit('Update Observation', array('class' => 'btn btn-primary')) }}

        {{ Form::close() }}
    </div>

@endsection

My Controller function:


public function update(Request $request, $id)
    {
        $data = [];
        //multiple file upload
        if ($request->hasfile('ImageUpload')) {
            foreach ($request->file('ImageUpload') as $image) {
                $name = $image->getClientOriginalName();
                $extension = $image->getClientOriginalExtension();
                $tmpFileName = $image->getFilename();
                Storage::disk('local')->put($tmpFileName . '.' . $extension, File::get($image));
                $data = $tmpFileName . '.' . $extension;
            }
        }

        $this->validate($request, [
            'ObservationNotes' => 'required',
            'ImageUpload.*' => 'image|mimes:jpeg, png, jpg, gif, svg',
            'UpdatingStaffId' => 'nullable'
        ]);

        $childObservation = ChildObservation::findOrFail($id);
        $updatedStaffId = Auth::id();


        $childObservation->ObservationDate = $request->ObservationDate;
        $childObservation->Observation = $request->Observation;
        $childObservation->Stage = $request->Stage;
        $childObservation->Level = $request->Level;
        $childObservation->ObservationNotes = $request->ObservationNotes;
        $childObservation->UpdatingStaffId = $updatedStaffId;

        //if there is no new images are added then $data is empty, if it is empty use the value of the hidden field using the last images used or null if no images
        if (empty($data)) $data = json_decode($request->OldChildUpload);

        $childObservation->UploadImage = $data;

        $childObservation->save();

        return redirect()->route('observations.index')
            ->with('flash_message',
                'Observation edited successfully!');
    }
28 Feb
4 months ago

futureperfect90 left a reply on Laravel 5 File(Image) Upload Example With Validation

When i try to use

$this->validate($request, [

    'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',

]);

I just get a blank white screen and it doesn't continue, anyone know why?