neflictus

neflictus

Member Since 1 Year Ago

Experience Points 450
Experience Level 1

4,550 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 1
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.

18 Apr
5 months ago

neflictus left a reply on Select With Over 10.000 Records

Already using one. I'm guessing I have to use Ajax and query the table as the user enters the data. Any examples?

neflictus started a new conversation Select With Over 10.000 Records

Hi

I'm having this issue. I have to display 13.000 records in a select box. The problem is that it takes forever to load them, and 1 second or more to display the results. I used cache, but nothing. Any solutions?

It's a multiselect textbox with autocomplete.

09 Feb
1 year ago

neflictus started a new conversation Abandoned Package

Hi

Facing a bit of a problem here. I have this huge project using https://github.com/proengsoft/laravel-jsvalidation, which seems to work with Laravel version up to 5.5.

I'm trying to update to Laravel 5.6, but this package is the only one that won't go.

I'm guessing that it was abandoned, but I want to keep using it, since I'm sure there won't be any compatibility issues.

Is there a solution to keep using it with Laravel 5.6 ?

06 Feb
1 year ago

neflictus started a new conversation Sending Email With Attachments From POST

I must be able to send an email to a couple of users and attach some files. I have in the view

            <div class="form-group">
                {{ Form::file('files',array('multiple' => true)) }}
            </div>

Controller:

Mail::to('[email protected]')->send(new SingleEmail($data));

Mailable:

public function build()
{
    $mailable =  $this->from($this->data['from_email'], $this->data['from_name'])
        ->to($this->data['to_email'])
        ->subject($this->data['subject'])
        ->markdown('emails.dashboard.singleEmail',['data' => $this->data]);


    $attachments = [];
    $filename = [];
    if(\Request::file('files')) {
        foreach (\Request::allFiles() as $attachment) {
            $attachments[] = [
                'file' => $attachment->getRealPath(),
                'options' => [
                    'mime' => $attachment->getClientMimeType(),
                    'as' => $attachment->getClientOriginalName()
                ]
            ];
        }
    }

    $mailable->attach($attachments);

    return $mailable;
}

I'm doing something wrong.

25 Jan
1 year ago

neflictus left a reply on Ajax Issue

Solved it. Thanks

var page=$(this).attr('href').split('page=')[1];
var url = '{{route('child.photos',$child)}}' + '?page=' + page;

neflictus started a new conversation Ajax Issue

Hello

I have 2 tables: Children and Media (Spatie MediaLibrary) When I edit the child, there are 2 tabs displayed: one with the child's information, the other - a list of pictures associated with the child.

I would like to paginate those pictures, as users might tend to upload too many photos. I would like to use Ajax, and use another method to display the records.

public function edit(Child $child, Request $request)
{
    $edit = true;
    $images = Child::find($child->id)->media('images')->paginate(1);
    return view('child.add-edit', compact('edit', 'child', 'images'));
}



public function photos(Child $child, Request $request) {
        $images =  Child::find($child->id)->media('images')->paginate(1);
        return view('child._photos', ['images' => $images, 'child' => $child])->render();
}

Main children view:

<div class="pictures">
    @include('child._photos')
</div>


<script type="text/javascript">

    $(function() {
        $('body').on('click', '.pagination a', function(e) {
            e.preventDefault();

            //var url = $(this).attr('href');
            var url = '{{route('child.photos',$child)}}';
            getPhotos(url);
        });

        function getPhotos(url) {
            $.ajax({
                url : url
            }).done(function (data) {
                $('.pictures').html(data);
            }).fail(function () {
                alert('Some sort of error.');
            });
        }
    });

</script>

_photos.blade.php

@if (count($images)>0)
    @foreach ($images as $media)
        <div class="col-md-2">
            {{$media->name}}
        </div>
@endforeach
{!! $images->links() !!}
@endif 

It always gets the first photos, never displaying the 2nd page. If I use the edit method to display the recods (var url = $(this).attr('href');), it works like a charm.

I'm missing something.

21 Jan
1 year ago

neflictus left a reply on Laravel Notification Thru Slack - Works When Called From Controller, Fails From Command

I got it. It was a code issue:

public function via($notifiable)
{
    if ($this->task->notification_type == 'telegram')
        return [TelegramChannel::class];
    else
        return [trim($this->task->notification_type)];
}

Task->notification_type was saved with a space in the table.

20 Jan
1 year ago

neflictus started a new conversation Laravel Notification Thru Slack - Works When Called From Controller, Fails From Command

I have a notification called TaskExpires

public function toSlack($notifiable) {
    $slack_id = $this->task->CreatedBy->slack_id ? $this->task->CreatedBy->slack_id : env('SLACK_DEFAULT_CHANNEL','#channelname');
    $user = $this->task->CreatedBy->username ? $this->task->CreatedBy->username : $this->task->CreatedBy->email;

    return (new SlackMessage)
        ->from('my_app_name', ':ghost:')
        ->to($slack_id)
        ->content($user.' - task #'.$this->task->getTitle().'# is about to expire. '.route('task.edit',$this->task->getId()));
}

If I'm calling it from the controller, it works with no issues.

public function view(Task $task)
{
    Auth::user()->notify(new TaskExpires($task));
    return view('task.view', compact('task'));
}

If I run it from inside a scheduled command, it fails to run, saying: Driver [slack ] not supported.

Command:

public function handle()
{
    $tasks = $this->tasks->getAllByWork();

    foreach ($tasks as $task) {

        switch ($task->notification_time) {
            case TaskNotifyTimes::NOTIFY_30MINUTE:
                if ($task->end >= \Carbon\Carbon::now()->subMinute(30) && $task->schedule_run == 0) {
                    $task->CreatedBy->notify(new TaskExpires($task));
                    $task->schedule_run = 1;
                    $task->save();
                }
                break;
               ................ 
        }
    }

I'm guessing it has something to do with Auth, since that seems to be the only difference when I run from a controller or inside a command.

From the Command it runs as guest, from the Controller it's authenticated.

04 Oct
1 year ago

neflictus left a reply on Ajax Dependent Comboboxes - Can't Get The Second Value To Be Loaded From The Database

Solved. Loaded the cities for the country in the controller.

neflictus started a new conversation Ajax Dependent Comboboxes - Can't Get The Second Value To Be Loaded From The Database

Table with children data (name, parents, id_country, id_city etc.)

I have 2 other tables: countries(id,name) and cities(id,name).

All works just fine, except when I edit the child. The countries get loaded, the cities get loaded accordingly, except the right id_city value isn't selected in the combobox.

I am just 2 days into the framework and I could use some help.

View:
{{ Form::select('id_country', $tari, Input::old('id_country') ? Input::old('id_country') : $child->id_country, array('id' => 'id_country')) }}

{{ Form::select('id_city',array(), Input::old('id_city') ? Input::old('id_city') : $child->id_city, array('id' => 'id_city')) }}




                    
Controller:
public function cities($id)
{
    $cities = City::select('id', 'name')->where('id_country',$id);
    $cities = $cities->orderby("name")->get();
    return $cities;
}



Javascript:
<script>
jQuery(document).ready(function($) {        
        $('#id_country').on('change', function(event) {
                $.ajax({
                    url: base_url + '/cities/'+$(this).val()
                })
                .done(function(data) {
                    var $selectCities = $('#id_city');
                    $selectCities.html('<option value=" ">-</option>');
                    for (var i = 0; i < data.length; i++) {
                        var $option = $('<option></option>');
                        $option.html(data[i].name);
                        $option.attr('value', data[i].id);
                        $selectCities.append($option);
                    }
                    $selectCities.change();
                })
                .fail(function() {
                    alert('Error');
                });
        });
        $('#id_country').change();
});
</script>