0 Best Reply Awards

  • Member Since 3 Years Ago
  • 60 Lessons Completed
  • 12 Favorites

12th January, 2018

wayanjimmy started a new conversation Laravel Null Object Pattern • 2 months ago

I think I have watched laracasts's video about Null object pattern and use Null User / Guest as the case. I need to rewatch it, but can't find it.

Does any one know the link to the video ?


14th April, 2016

wayanjimmy started a new conversation I've Set Default User Id = 1 If User Is Guest , Any Idea The Best Way To Implement It ? • 1 year ago

I currently working on e-commerce website that allow guest user to add product into cart, So I set the default user id for guest is = 1, currently I just define a method in BaseController just like this

class Controller 
    protected method getCurrentUserId() 
        if (Auth::guest()) return 1;
        return Auth::id();

Any idea about better approaches in Laravel ? I'm just curios how to do it more better, and testable

5th April, 2016

wayanjimmy left a reply on ShouldQueue Event Email Sending • 1 year ago

I think you should make a job instead of an event

28th June, 2015

wayanjimmy left a reply on Laravel 5 / AngularJS CORS Issue • 2 years ago

The header code must exactly run before the routes, and i think middleware it's the right place to put the code. It's mentioned in the laravel docs http://laravel.com/docs/5.1/middleware#registering-middleware, in Introduction it's talk about CORS middleware. CMIIW

wayanjimmy left a reply on Laravel 5 / AngularJS CORS Issue • 2 years ago

Tryout to make a middleware

<?php namespace App\Http\Middleware;

use Closure;

class CorsMiddleware {

     * Run the request filter.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
    public function handle($request, Closure $next)
        header("Access-Control-Allow-Origin: *");
        header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
        header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
        header('Access-Control-Allow-Credentials: true');

        if (!$request->isMethod('options')) {
                return $next($request);


don't forget to register it globally

26th March, 2015

wayanjimmy left a reply on Setting Up Laravel5 + Angular • 2 years ago

If your application is not a SPA, then use laravel routes instead of angular.

Edit Your Profile

Want to change your profile photo? We pull from gravatar.com.