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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

18 Apr
2 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?

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.

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:

@include('child._photos')
<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)

{{$media->name}}

added: {{ $media->created_at->format(config('app.date_time_format')) }}

@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 a controller, it works, no issues. 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 TaskExpira($task));
                    $task->schedule_run = 1;
                    $task->save();
                }
                break;
               ................ 
        }
    }
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:

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('-'); for (var i = 0; i < data.length; i++) { var $option = $(''); $option.html(data[i].name); $option.attr('value', data[i].id); $selectCities.append($option); } $selectCities.change(); }) .fail(function() { alert('Error'); }); }); $('#id_country').change(); });