JerryBels

JerryBels

Member Since 1 Month Ago

Experience Points
160
Total
Experience

4,840 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 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
160 XP
Sep
24
1 month ago
Activity icon

Awarded Best Reply on Localize App With Jetstream

Finally successfully nailed this. I simply disabled routes from Fortify and Jetstream, copied them over and shoved them inside my grouped prefix routes. Still using https://github.com/mcamara/laravel-localization.

In JetstreamServiceProvider :

public function register() {
        Jetstream::ignoreRoutes();
    }

In FortifyServiceProvider :

public function register() {
        Fortify::ignoreRoutes();
    }

And copy over routes from Fortify vendor/laravel/fortify/routes/routes.php and Jetstream vendor/laravel/jetstream/routes/livewire.php (I guess adapt to Inertia if you're working with this) over to your web.php file, inside a route group with the prefix you need.

Activity icon

Replied to Localize App With Jetstream

Finally successfully nailed this. I simply disabled routes from Fortify and Jetstream, copied them over and shoved them inside my grouped prefix routes. Still using https://github.com/mcamara/laravel-localization.

In JetstreamServiceProvider :

public function register() {
        Jetstream::ignoreRoutes();
    }

In FortifyServiceProvider :

public function register() {
        Fortify::ignoreRoutes();
    }

And copy over routes from Fortify vendor/laravel/fortify/routes/routes.php and Jetstream vendor/laravel/jetstream/routes/livewire.php (I guess adapt to Inertia if you're working with this) over to your web.php file, inside a route group with the prefix you need.

Activity icon

Replied to Change Route In Middleware

@a4ashraf I'm aware I could do this :) thanks but it's not what I'm looking for - there are some routes I don't have access to.

@sinnbeck yeah I used mcamara package in one experiment, it doesn't work well with Jetstream. ATM I'm trying to use it anyway while redefining all of Jetstream and Fortify routes... Still in trouble trying that. I have a simple solution that works though when all of the routing is unaware of the language in the url - that's why it would be perfect for me to set it in a middleware and process the request without it... Which is my original question.

Activity icon

Started a new Conversation Change Route In Middleware

Hi guys :)

Let's say I have this kind of URLs :

example.com/en/
example.com/en/login
example.com/fr/login

I would like to use a middleware to set the language and then return the route to be handled without the language part. So the router would get / or /login, without any language stuff.

public function handle(Request $request, Closure $next) {
        app()->setLocale($request->segment(1));
        // $request->server->set('REQUEST_URI', substr($_SERVER['REQUEST_URI'], 4));// not working

        return $next($request);
    }

Thanks ahead

Sep
23
1 month ago
Activity icon

Started a new Conversation Localize App With Jetstream

Hello,

I'm trying to start a project with jetstream, on Laravel 8, while handling multiple languages. All views in Jetstream are already set to be translated - so it's fine here. But how would you go about letting the user choose his language?

My first idea was to go like mylaravel.com/en/somepage. I tried to implement it using https://github.com/mcamara/laravel-localization but it won't work with jetstream - or at least I didn't successfully make it work. I didn't find how I could force jetstream (and fortify) to take a prefix and set the language according to it. My experiment about this after some suggestions from a user on SO got like this. I tried to add a middleware to handle setting the locale. Added :

Fortify.php :

    'path' => '{lang}',
    'middleware' => ['web', 'setLang']

new middleware setLang :

class SetLang {
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle(\Illuminate\Http\Request $request, Closure $next) {
        // $lang = 'en';
        // $request->attributes->add(['lang' => 'en']);
        $request->route()->setParameter('lang', 'en');
        // $request->request->set('lang', 'en');

        return $next($request);
    }
}

Added the middleware to $routeMiddleware.

I'm receiving this error when trying to reach http://mylaravel/en/login :

ErrorException
Missing required parameters for [Route: login] [URI: {lang}/login]. (View: /var/www/resources/views/auth/login.blade.php)

So I saved this experiment on a branch and got back to my previous commit, without https://github.com/mcamara/laravel-localization. I had an idea I wanted to explore, and I found something very close to it here : https://learninglaravel.net/forum/laraveltutorials/how-to-use-multiple-languages-in-your-laravel-5-website

i tried to implement it but now everything is returning a 404... Is it a difference between Laravel 5 and 8?

Another approach I'm yet to try would be to have a specific button dedicated to set the language on the website, without using the url at all, and trying to set the default language if the user never chose one by detecting the browser language. Saving this to session and cookies I guess.

What do you think?

Sep
17
1 month ago
Activity icon

Replied to Image Cant Loaded , When Using Laravel Jetstream

Thanks guys it's fine now :)

Sep
16
1 month ago
Activity icon

Replied to Image Cant Loaded , When Using Laravel Jetstream

@newbie360 thanks for helping. Although, I'm not sure what you would have me do. The link can't be created like that, and doesn't it feel strange that you have to go and make such a link by hand ?

Maybe I should have said that my docker is on a linux os as well (debian).

Activity icon

Replied to Image Cant Loaded , When Using Laravel Jetstream

Hello, I have a similar issue, just installed everything on a fresh install (I'm working in a docker) - my app url is http://localhost:60080/ and I registered a user thanks to JetStream. After registering I uploaded a profile picture, and it doesn't show. The url it tries to load is http://localhost:60080/storage/profile-photos/yfdHpOaS24UO9aTUUhGx7W5O3Bwg3urySGIjWqBb.gif but somehow it's not right and I can't find why.

APP_URL=http://localhost:60080
'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],