Giorgiovski

Giorgiovski

Member Since 1 Month Ago

Experience Points
540
Total
Experience

4,460 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.

Level 1
540 XP
Jan
17
21 hours 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
3 days 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
5 days 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
1 month 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}', '[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
1 month 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
1 month 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.