Giorgiovski

Giorgiovski

Member Since 3 Months Ago

Experience Points
840
Total
Experience

4,160 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 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 1
840 XP
Feb
12
1 month ago
Activity icon

Started a new Conversation Update The Notifications Counter And Dropdown Items With Pusher

I implemented a simple notifications system in Laravel 6. Now I'm trying to migrate to real-time notifications, I mean when a new notification is there to change the bell counter(unread notifications) and update the dropdown items. How can I update the counter(badge) and update this dropdown without refresh the page?

Now just I displaying the results in console:

My app.js to update in real-time with Laravel-echo

Echo.private('App.User.' + userId)
    .notification((notification) => {
        console.log(notification.type);
    });

Thank you.

Jan
31
2 months ago
Activity icon

Started a new Conversation Laravel Forms SELECT RANGE Based On Another SELECT RANGE

I want to select an interval of two hours. In order to do that, I want the second selectRange input to display a minimum hour depends on the first selectRange input. If on the first input the hour is 12:00, don't allow me to select 11:00. Selecting an hour less than the first hour is illogic.

My forms

{{Form::label('sessionHour', 'From the hour: ', ['class' => 'input-group-prepend input-group-text'])}}
{{Form::selectRange('sessionHourFrom', 6, 23 , null, ['class' => 'form-control'] )}}
{{Form::label('sessionHourTo', 'to hour: ', ['class' => 'input-group-prepend input-group-text'])}}
{{Form::selectRange('sessionHourTo', 6, 23 , null, ['class' => 'form-control'] )}}

Wrong case example: https://imgur.com/a/AVcDCvs

Thanks

Jan
27
2 months ago
Activity icon

Replied to AJAX - Refreshing The Content When Clicked A Button

@jlrdw The first part is done. I have to do only that part where I update the element with the real-time results from DB.

To add 1 if I press the button is not a great idea because the user can also cancel the reaction like on Facebook: IF the reaction already exists, delete this reaction and decrement count by -1. So that is not an idea to get through.

I dug tons of pages and I don't know how to retrieve data from controller to AJAX but there are only few ideas. Maybe is not a common and great practice. The pre-solution in my head for the moment is:

1)Take data from the controller directly in ajax call; 2)Populate dynamically the element with the suited details for each post.

Just an idea. But I don't know how to handle it yet. Thank you.

Activity icon

Replied to AJAX - Refreshing The Content When Clicked A Button

Hello, @cronix .Thank you for your interest.

I am a newbie in AJAX and is still confusing for me. With the statement tagged by you I want just to refresh the content of this element. But as I said, if I have 7 posts in foreach there will be 7 digits because the ajax goes through this loop.

In simple terms, I want just to increment or decrement likes when someone clicks on a reaction button. But in a real manner, exactly like in the database table. If you have another idea to acquire these things, please give me that.

The data returns nothing, I just tried to test the inputs.

Activity icon

Replied to AJAX - Refreshing The Content When Clicked A Button

@jlrdw I don't refer at front end part and the position of those reactions. I don't care for the moment. I am interested only for logic part.

@foreach($getAllStories as $story)
                <div class="col-md-10 mx-auto">
                    <div class="card mb-3"
                        style="padding: 15px; border-top-left-radius: 15px; border-bottom-left-radius: 15px;">
                        <div class="row no-gutters">
                            {{-- Get the story status --}}
                            <div class="col-md-12 text-center">
                                <p>{{$story->post_status}}</p>
                            </div>

                            <div class="col-md-12">
                                <img src="/storage/stories_photos/{{$story->image_path}}" alt="StoryImage"
                                    style="border-top-left-radius: 15px; border-bottom-left-radius: 15px;"
                                    class="float-left">
                                {!!Form::open(['id' => 'submitReactionForm'])!!}
                                {{-- The reaction details for passing them to the controller --}}
                                {{Form::text('getStoryId', $story->story_id, ['hidden' => 'hidden', 'id' => 'getStoryId'])}}
                                {{Form::hidden('_method','POST')}}

                                {{Form::button('<i class="fa fa-4x fa-smile-o" aria-hidden="true"></i>', ['class' => 'btn btn-sm btn-danger float-right getButtonValue',  'id' => 'reactionButton1', 'title' => 'WoW! So nice!', 'value' => 'reaction1', 'name' => 'reactionButton'])}}
                                <p class="float-right wowReactionCounter">{{$story->wow_count}}</p><br><br><br>

                                {{Form::button('<i class="fa fa-4x fa-gratipay" aria-hidden="true"></i>', ['class' => 'btn btn-sm btn-primary float-right getButtonValue',  'id' => 'reactionButton2', 'title' => 'I love that, I want that!', 'value' => 'reaction2', 'name' => 'reactionButton'])}}
                                <p class="float-right wantReactionCounter">{{$story->wants_count}}</p><br><br><br>

                                {{Form::button('<i class="fa fa-4x fa-hand-peace-o" aria-hidden="true"></i>', ['class' => 'btn btn-sm btn-success float-right getButtonValue',  'id' => 'reactionButton3', 'title' => 'Congrats\'!', 'value' => 'reaction3', 'name' => 'reactionButton'])}}
                                <p class="float-right congratsReactionCounter">{{$story->congrats_count}}</p>
                                <br><br><br>

                                {{Form::button('<i class="fa fa-4x fa-frown-o" aria-hidden="true"></i>', ['class' => 'btn btn-sm btn-warning float-right getButtonValue',  'id' => 'reactionButton4', 'title' => 'You make me feel sad! I\'m sorry! :(', 'value' => 'reaction4', 'name' => 'reactionButton'])}}
                                <p class="float-right sadReactionCounter">{{$story->sad_count}}</p><br><br><br>
                                {!!Form::close()!!}
                            </div>

                            <div class="col-md-12">

                                @if(auth()->user()->id == $story->posted_by)
                                {{--If you have posts in the newsfeed, show if that post is posted by you--}}
                                <small class="card-title"><span class="text-primary"><b>You</b></span> posted that on
                                    <span class="text-warning">{{$story->storyCreatedAt}}</span></small>
                                @else
                                <small class="card-title">Posted by <span
                                        class="text-primary"><b>{{$story->name}}</b></span> on <span
                                        class="text-warning">{{$story->storyCreatedAt}}</span></small>
                                @endif
                            </div>

                        </div>

                    </div>
                </div>
                @endforeach
Activity icon

Started a new Conversation AJAX - Refreshing The Content When Clicked A Button

I have a page with some reactions. I made the insertion in DB with AJAX but now I want to refresh all counters after every click on a reaction. These reactions are into a foreach loop. I tried with

$.ajax({
       type:'POST',
       url:"/postReaction",
       data:{getStoryId:getStoryId, getReactionValue:getReactionValue},
       success:function(data){ 
            //Refresh all counters text
            $('.wowReactionCounter').load(' .wowReactionCounter');
            $('.wantReactionCounter').load(' .wantReactionCounter');
            $('.congratsReactionCounter').load(' .congratsReactionCounter');
            $('.sadReactionCounter').load(' .sadReactionCounter');
       }

but because foreach loop there is added a lot of zeros in text, depends how much items foreach has. The second issue is that is very laggy.

View before Ajax success and after: https://imgur.com/a/loL70NB

What can I do in order to achieve that in this foreach and to be fast, like instant likes?

Jan
20
2 months ago
Activity icon

Replied to Using WhereNotNull In Eloquent Laravel 6

Now I've got

Algolia\AlgoliaSearch\Exceptions\BadRequestException
Invalid syntax for numeric condition:email_verified_at=<>
Activity icon

Started a new Conversation Using WhereNotNull In Eloquent Laravel 6

Hi. I'm trying to search only users with verified email. I use Scout and Algolia.

I tried

$getRegularUsersScoutAction = User::search()
                     ->where('role_id', '3')
                     ->whereNotNull('email_verified_at')
                     ->get();

but I got

Method Laravel\Scout\Builder::whereNotNull does not exist

How can I sort records if a column is null in SCOUT? Thank you.

Jan
19
2 months ago
Activity icon

Started a new Conversation Displaying Things From Foreach Inside Foreach

I have an invitation table and a page where I search for users. I want to change the status of the button depends if the user was already invited or no.

@foreach($getRegularUsersScoutAction as $regularUser)
<div class="col-md-6">
    <div class="card mb-3" id="cardForEveryTrainerResultInSearch">
        <div class="row no-gutters">
            <div class="col-md-5">
                <img src="/storage/user_avatars/{{$regularUser->user_avatar}}" alt="Avatar" id="trainerAvatarSearchesImage">
            </div>

            <div class="col-md-7">
                <div class="card-body">
                    <h5 class="card-title">{{$regularUser->name}}</h5>
                    <p class="card-text"><small>Live Area </small>{{$regularUser->city_activity}}</p>
                    <p class="card-text"><small>Rating </small>723 feedbacks</p>
                    <hr> @if(count($getAndCheckInvitations) > 0) @foreach($getAndCheckInvitations as $invitation) @if($invitation['regular_user_id'] == $regularUser->id)
                    <button class="btn btn-small btn-secondary text-light" id="giveAWave" disabled>You already invited this user</button>
                    @else
                    <a class="btn btn-small btn-info" href="/inviteUsers/{{$regularUser->id}}" id="giveAWave">Give a wave to this user</a> @endif @endforeach @endif
                </div>
            </div>

        </div>

    </div>
</div>
@endforeach

The problem is even I have else if for this condition($invitation['regular_user_id'] == $regularUser->id) the second button is displayed many times for all users.

https://imgur.com/a/ntcjSj6

I want to display only a button depends on the record in the invitation table. Thank you.

Jan
17
2 months ago
Activity icon

Started a new Conversation Implementing A 5 Star Review Functionality

Hello. I have a project where types of users interact with each other. I want to allow them to give feedback after the service between they is finished. Like I have a class with a teacher, after it ends, let me write a review/give feedback about the teacher. It's not a product review way.

Is there a great way to use some bundles like laravel-rateable? Or I can simple do that? Just some ideas from your experience. Thank you.

Jan
14
2 months ago
Activity icon

Awarded Best Reply on Image Path Issues At First Login

Update: SOLVED. The problem was the record with the default image was filled at the first contact with the profile page, then after the record was read. And when it was read it was null, of course, because is read the first time and after that populated.

I solved this problem by adding a field in the RegisterController and User model fillable to insert a record with the default image once with register process, not after.

protected function create(array $data)
    {
        return User::create([
            
            'user_avatar' => 'no_image.jpg',
        ]);
    }

Thank you all.

Activity icon

Replied to Image Path Issues At First Login

Update: SOLVED. The problem was the record with the default image was filled at the first contact with the profile page, then after the record was read. And when it was read it was null, of course, because is read the first time and after that populated.

I solved this problem by adding a field in the RegisterController and User model fillable to insert a record with the default image once with register process, not after.

protected function create(array $data)
    {
        return User::create([
            
            'user_avatar' => 'no_image.jpg',
        ]);
    }

Thank you all.

Activity icon

Replied to Image Path Issues At First Login

@xyundy I tested and the record is not updated when I have the first login. It's still null. Is needed a refresh to insert that no_image.jpg in the column. I can't understand why.

Activity icon

Replied to Image Path Issues At First Login

@xyundy

Where avatar get the path:

{{-- Getting avatar  for regular user--}}
                                                <div class="text-center">
                                                        <img src="/storage/user_avatars/{{auth()->user()->user_avatar}}" alt="Avatar" class="img-thumbnail rounded-circle" style="height: 220px !important; width:220px !important;">
                                                </div>

Routes related to first login:

Route::get('/home', function(){ return redirect('profile/'.auth()->user()->id); })->middleware(['auth','verified']);

Route::resource('profile', 'ProfileController')->middleware(['auth','verified']);

ProfileController where I pass the variables:

class ProfileController extends Controller
{
     /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware(['auth', 'verified']);
       
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        // /profile displayed nothing. I redirect from this to properly route.
        return redirect('/profile/'.auth()->user()->id);
    }

public function show($userId){
            $insertDefaultAvatar = User::find($userId);
                        if (is_null($insertDefaultAvatar->user_avatar)) {
                            $insertDefaultAvatar->user_avatar = 'no_image.jpg';
                            $insertDefaultAvatar->save();
                        }
}

In this show function I auto insert the default image for users. I Think there is a problem. Because at the first access the function just write the record in user_avatar column. And of course is needed a refresh to take that record. The function just load the record before all, when the record is null.

Thank you for your interest to help me.

Activity icon

Replied to Image Path Issues At First Login

Thabk you but what code? It works perfect but just at first login I get this issue.

Activity icon

Replied to Image Path Issues At First Login

@snapey It is. It's directly in his profile. But maybe the request can't take the path from DB at first login.

Activity icon

Started a new Conversation Image Path Issues At First Login

First, I have this problem since when I moved from XAMPP to Homestead.

When I create an account I am redirected to the profile page. The problem is that the avatar path is not loaded with the image name but only project.test/storage/user_avatars/ instead of project.test/storage/user_avatars/AVATAR_NAME.jpg .

https://imgur.com/nAFM4Lz

If I refresh the page again, after first login, it takes the right path. Why does it not work for the first login? There are no logic. :) Thank you.

Jan
12
2 months ago
Activity icon

Replied to Wrong Redirection After Login

@snapey Anyway, thank you very much!

Activity icon

Replied to Wrong Redirection After Login

First question, no chance.

Second, I did that right now and it's like bullshit code but this is the moment solution for that. I added route /home with redirection.

Route::get('/home', function(){ return redirect('profile/'.auth()->user()->id); })->middleware('auth');
Activity icon

Replied to Wrong Redirection After Login

Yes. Like myapp.test/home. It's so weird.

Activity icon

Replied to Wrong Redirection After Login

Returns 404 not found and is normal because I don't have /home nowhere in my app. I think is related to vagrant and homestead because this problem appeared at that moment.

Activity icon

Started a new Conversation Wrong Redirection After Login

First, in the beginning, I moved from /home to /profile. I deleted all redirections and details about /home of the entire app. It worked with zero problems. The issue is that after I moved from XAMPP to HOMESTEAD. When the user finishes the registration process, he is redirected to /home. And of course, it is not found. I repeat I have this issue because I installed Homestead.

I have no result when I'm searching for /home in my app, I cleared all caches, I checked all the files associated with redirection. By the way, my RedirectIfAuth looks like:

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect('profile/'.auth()->user()->id);
        }

        return $next($request);
    }
}

The error:

/home/vagrant/LaravelProjects/Changizator/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php#179
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
            return $this->getRouteForMethods($request, $others);
        }

        throw new NotFoundHttpException;
    } 

I can't understand where is the problem because worked months but after I installed Homestead that was the result. Thank you very much.

Dec
17
3 months ago
Activity icon

Replied to Update Just Only One Record By Eloquent - Error

@snapey If in the first query I put get() instead first() the $getOnlySessionStatus contains just one record. But with first() it contains more.

Activity icon

Replied to Update Just Only One Record By Eloquent - Error

@snapey 'Open'. That doesn't matter. I want to save only the element found in the first query. Not all my elements from this table by those columns.

Activity icon

Started a new Conversation Update Just Only One Record By Eloquent - Error

I want to update only the requested element but the query update all the entries from this table. I don't know why.

public function updateEverySessionByClick(Request $request, $trainerId){
        
        //split the string from one variable to two for hour and status like: $var = hour , $var2 = status because I am supposed to search in two columns, not in one. I have 09:00 Busy in one string
        $splitHourAndStatus = explode(" ", $request->sessionHourForUpdate);
        $searchSessionStatus = Session::where('added_by', $trainerId)
                                                           ->where('session_date', $request->sessionDateForUpdate)
                                                           ->where('session_hour', rtrim($splitHourAndStatus[0])) 
                                                           ->where('session_status', ltrim($splitHourAndStatus[1]))
                                                           ->first();

        $getOnlySessionStatus = $searchSessionStatus->pluck('session_status');
        $getOnlySessionStatus = substr($getOnlySessionStatus, 2, -2); //remove first 2 and last 2 chars from array. Like ["  "] to get just the status
        
        // Update the recent status with new one in the database
//############################################I THINK HERE IS THE PROBLEM
        // if($getOnlySessionStatus == 'Busy'){
            $updateRecentStatus = $searchSessionStatus;
            $updateRecentStatus->session_status = 'Open';
            $updateRecentStatus->save();
        // }

        //return success message
        return redirect('profile/'.auth()->user()->id)->with('success', $getOnlySessionStatus);
    }

After the function ends all my records are updated with "OPEN" status. All of them. Thank you in advance.

Activity icon

Replied to Problem With Calling Another Function From The Same Controller

@sinnbeck I've learned a great lesson today, sir! Thank you very much!

Activity icon

Replied to Problem With Calling Another Function From The Same Controller

I think is about _method. When I change it and I've got another wrong message. I want just to pass data from form to controller.

Activity icon

Started a new Conversation Problem With Calling Another Function From The Same Controller

I have a page with many forms. I have different routes for the actions. I don't know why when I'm clicking another function actually don't let me submit because it is calling the validate function FROM ANOTHER FUNCTION from the controller.

I receive the message: the session date is required. But the functions are different. Why is called the second function? Thank you.

Form

{!! Form::open(['route' => ['session.updateEverySessionByClick', auth()->user()->id]]) !!}
                                                                        {{Form::text('sessionHourForUpdate', '', ['class' => 'form-control', 'id' => 'sessionHourForUpdate'])}}
                                                                        {{Form::submit('Update session status', ['class' => 'btn btn-sm btn-primary', 'id' => 'submitUpdateStatusOfSession'])}}
                                                                {!!Form::close()!!}

The routes

Route::post('profile/{id}', '[email protected]')->name('session.save');
Route::post('profile/{id}', 'S[email protected]')->name('session.updateEverySessionByClick');

The controller functions

class SessionController extends Controller
{

    public function updateEverySessionByClick(Request $request, $trainerId){
        $ceva = $request->sessionHourForUpdate;
        return redirect('profile/'.auth()->user()->id)->with('success', $ceva);
    }


    public function saveSession(Request $request, $trainerId){
    
        $this->validate($request,[
            'sessionDate'=>'required',
         ]);

    //rest of the code
    }
}
Dec
11
3 months ago
Activity icon

Started a new Conversation Print Input Value In Blade

Hello, mates! I have a hidden text input in HTML which is populated with dynamic data from JS. Is there a way to print its value below on the page in blade?

Thanks.

Dec
04
3 months ago
Activity icon

Replied to The Bootstrap/cache Directory Must Be Present And Writable On Shared Hosting Laravel

Thanks! It also works for me after I searching an hour for this crazy error that came from the unknown.