stefan7

stefan7

Member Since 2 Years Ago

Experience Points
6,490
Total
Experience

3,510 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
49
Lessons
Completed
Best Reply Awards
1
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 2
6,490 XP
May
28
5 days ago
Activity icon

Replied to Routes: Switch Different Actions Depending On The Slug Without Changing Url

The party you did not understand is shown in my code example above with the if/elseif. Depending on the $routeKey record it will choose another controller and another action.

I think I solved this party already with the following

 return App::make('App\Http\Controllers\CategoryController')->show($category->slug, request() );

also possible seems to be

$request = Request::create('c/'.$category->slug, 'GET');
return Route::dispatch($request);

I know this use case sounds in general pretty weird as you normally would make clean routes for each controller action. In this case the client requested something more flexibel for his own reason.

Activity icon

Started a new Conversation Routes: Switch Different Actions Depending On The Slug Without Changing Url

I have a fallback route, at the end of the web.php. It looks in a model for the current slug and should redirect to the correct controller action. If no slug is found, then it will proceed to show 404 error.

In this fallback route I want to have the possibility to decide which controller and which action to call. The problem is that if I call just Route::get() oder redirect->route() it will change the url. But I want to stay the url the same. Is that possible?

My current route function:

Route::get('/{any}', function ($any){
    $routeKey = \App\Models\RouteKey::where('key', $any)->first();
    if(is_null($routeKey)) {
        abort(404);
    }

    if($routeKey->routable_type == 'App\Models\Category') {
        return redirect()->route('category.show', $routeKey->routable_id);
        //return action('[email protected]', $category->slug);
    } elseif($routeKey->routable_type == 'App\Models\Product') {
        return redirect()->route('product.show', $routeKey->routable_id);
    }
});

May
11
3 weeks ago
Activity icon

Started a new Conversation Use Flexible Route Parameters For Filtering

I try to realise flexible route parameters. The parameters decide which filters should be active on a category page. Examples:

shoes.com/sneakers/white

shoes.com/white/42

shoes.com/female/red

I know, this is mostly done by adding query parameters (?color=red...) but in this case it should be done like the url's above.

There is no fixed structure to follow, like you would do it mostly with routes like '{categoryName}/{color?}/{size?}'

So I thought to make a model CategoryFilter that as a attribute for the complete url-path (exluding domain, exluding parameters) and to save the filters that need to be triggered in a json attribute(color:red, size:39).

To use a "any" route to catch everything and check if the url path i a category page with filters

Route::any('/', '[email protected]')->name('category.show')->middleware('checkIfCategoryPage');

Now I got stuck with the Middleware which should load in the end the category page with the filters but NOT change the url

    public function handle($request, Closure $next)
    {
        $categoryFilter = CategoryFilter::where('path', $request->path())->first();
        if($categoryFilter) {
            $request = Request::create(action('[email protected]', ['slug' =>$categoryFilter->category->slug, 'categoryFilterID' => $categoryFilter->id]), 'GET');
        }
        return $next($request);
    }

This middleware results in a 404 error. How can I solve this or do you have other solutions/best practices for me?

Apr
30
1 month ago
Activity icon

Awarded Best Reply on How Show Image In A Bootsrap Modal

I think you are looking more for a library like Fancybox or Lightbox than modals. This should do what you want:

http://fancyapps.com/fancybox/3/

Activity icon

Replied to How Show Image In A Bootsrap Modal

I think you are looking more for a library like Fancybox or Lightbox than modals. This should do what you want:

http://fancyapps.com/fancybox/3/

Apr
29
1 month ago
Activity icon

Replied to How Show Image In A Bootsrap Modal

Just put your loop for images and further content inside of the class "modal-body". Another tip, Laravel provides the $loop variable inside of a @foreach, so you do not need to do $id++; Just use $loop->index and it will give you the same number. https://laravel.com/docs/7.x/blade#the-loop-variable

<div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
   @foreach($files as $file)
       <img class="btn p-0 card-img3" src="{{$file->image}}">
   @endforeach
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>

Jan
25
4 months ago
Activity icon

Replied to Save Vue Js Components In Separate File

I was missing the point, that I need to create this file in order to make it work: /resources/admin.js

So i copied the app.js into the same folder an named it admin.js

Now with the other steps you mentioned for webpack.mix.js and the blade file it works, thank you!

Jan
24
4 months ago
Activity icon

Replied to Save Vue Js Components In Separate File

Thank you, how do I define which Vue component will be added to which file?

For example, if I want that this banner-component will only be in the admin.js

Vue.component('banner-component', require('./components/BannerComponent.vue').default);
Activity icon

Started a new Conversation Save Vue Js Components In Separate File

Hi, I want to generate a separate js file for the vue components of the admin area. how can i do that? For me this sounds simple but could not find anything after longer research.

Another thing is that i want to have a hash or similar added to the js filename, but version() is not working?

webpack.mix.js

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .version();

app.blade

<script src="{{ asset('js/app.js') }}"></script>

resources/js/app.js

Vue.component('banner-component', require('./components/BannerComponent.vue').default);
Jan
08
4 months ago
Activity icon

Started a new Conversation Medialibrary Conversion Takes Long Time

I use spatie/laravel-medialibrary with conversions to create image thumbnails. Also there is laravel forge with redis as queue driver.

But it takes sometimes huge amount of time (hours) until the conversions are created and during that time visitors do not see the thumbnails.

This conversions should be at this time the only Job in the system to work at. Image size is small < 1MB

What could i do? Or what could I check? any commands?