rouge847

rouge847

Member Since 2 Years Ago

Jakarta, ID

Full Stack Web Developer at Exinio

Experience Points 33,390
Experience Level 7

1,610 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 322
Lessons
Completed
Best Reply Awards 2
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.

13 Sep
1 week ago

rouge847 left a reply on Loop Through A Array And Add Values Of First Row Of Each Array To Table Cells

Your array structure is not ideal for what you want to achieve though not impossible. Ideally it should look like this:

$collection = collect([
    [
        'header' => 'Title 1',
        'june' => 1222,
        'july' => 32323,
        'total' => 323332
    ],
    [
        'header' => 'Title 2',
        'june' => 232323,
        'july' => 32313,
        'total' => 3233
    ],
    [
        'header' => 'Title 3',
        'june' => 23423,
        'july' => 32333,
        'total' => 43242
    ]
]);

And you can render them in blade this way:

<table class="table">
    <thead class="thead-light">
        <tr>
            <th>Balance</th>
            <th>July</th>
            <th>June</th>
            <th>Total</th>
        </tr>
    </thead>
    <tbody>
        @foreach ($collection as $row)
            <tr>
                <th scope="row">{{ $row['header'] }}</th>
                <td>{{ $row['july'] }}</td>
                <td>{{ $row['june'] }}</td>
                <td>{{ $row['total'] }}</td>
            </tr>
        @endforeach
    </tbody>
</table>

If you can't change the array, then you need to process the collection first like shown below. After that, you can use the same blade above. Be aware though, this is very prone to error, it's much better to have the array formatted correctly to begin with.

$data = collect([
    'months' => [
        'june' =>  [1222, 232323, 23423],
        'july' => [32323, 32313, 32333],
    ],
    'total' => [323332, 3233, 43242] 
]);

$collection = collect(['Title 1', 'Title 2', 'Title 3'])->map(function ($header, $i) use ($data) {
    return [
        'header' => $header,
        'june' => $data['months']['june'][$i],
        'july' => $data['months']['july'][$i],
        'total' => $data['total'][$i]
    ];
});
11 Sep
1 week ago

rouge847 left a reply on Vimeo - You Have Been Temporarily Blocked

I've been in contact with @VimeoStaff on Twitter and they said they are blocking some cloud providers due to widespread malicious traffic. The CAPTCHA supposedly able to filter out the legitimate traffic but currently there is an issue on their end.

I'm in the process of white listing my IP but they can't promise if they were able to do it, especially for IP from shared hosting. It would be great if we have alternative way to watch Laracasts video @jeffreyway.

04 Sep
2 weeks ago

rouge847 started a new conversation Vimeo - You Have Been Temporarily Blocked

Is anyone experiencing same issue with Vimeo? Vimeo is blocked in my country, but I have been able to watch it through VPN. This just start suddenly out of nowhere today. If I go directly to vimeo.com, I got following message:

Pardon the inconvenience, but our servers have detected a high number of errors from your connection. To continue, please verify that you are a human:

There is a google recaptcha checkbox and when I checked them, then it shows this message:

Thank you! One moment... You have been unblocked, but it can take up to a minute for our servers to update and let you back in. This page will forward you along automatically soon. Sorry for the inconvenience.

But it just stuck there, and when I check my network tab, it shows multiple 403 error from get requests to https://vimeo.com/_pingback

From googling around, it seems the exact same thing happened to someone else back in 2013 and it only got resolved by contacting Vimeo directly from twitter..

04 Jul
1 year ago

rouge847 left a reply on Where Are You All From?

Jakarta, Indonesia

rouge847 left a reply on Return View('page', Compact('data')); Not Openning

There are few things that need to be pointed out with your approach here.

  • update method is meant to be used to handle just updating the record. To return the view, you'll need to redirect to the method for showing the updated data, usually show method, after successfully update the record. And it is recommended to use patch for updating record.

    Route

    Route::get('test-data/{data}', '[email protected]')->name('data.show');
    Route::patch('test-data/{data}', '[email protected]');
    

    Controller

    public function show(AddTestData $data)
    {
        return view('data.show', compact('data'));
    }
    
    public function update(Request $request, AddTestData $data)
    {
        // Validate your request
        // Update data record
        
        // Will be triggered for axios request
        if ($request->expectsJson())
             return response('Data updated', 200);
    
        // Will be triggered when updating using traditional form request
        // Ignore this part if you only use axios
        return redirect()->route('data.show', $data->id);
    }
    
  • axios is an Ajax operation so it would not refresh unless you told them to. So in this case, you can simply redirect using javascript to the page that returns the view after the axios patch request is successful.

    <template>
        <button @click="update">Update</button>
    </template>
    
    <script>
        export default {
            props: ['data'],
            methods: {
                update() {
                    axios.patch('/test-data/' + this.data.id, {
                        foo: 'bar'
                    }).then(() => {
                        window.location.href = '/test-data/' +  this.data.id; //redirect to view
                    });
                }
            }
        }
    </script>
    

rouge847 left a reply on Better Query With Relations Then This

It's a classic n+1 problem. You can fix it by eager load the plays and user first before iterating the $game in a for loop.

You can watch the lesson linked below to see the workflow to fix this problem.

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/20

rouge847 left a reply on Update Inner Text Of A Variable

I would recommend using Vue for this. I have been using jQuery too for a long time and have been reluctant to learn Vue until recently. That was the best decision I've made in a while, it was so much better and easier for handling a task like this compared to jQuery.

I would recommend you to watch this series to quickly learn Vue 2.0.

If you're not familiar with ES2015 and above yet, you may want to watch the series too.

rouge847 left a reply on How To Set Url As Http://localhost:8000/post-ad/catagory/1

First, define the route for the category:

Route::get('post-ad/category/{category}', '[email protected]')->name('category');
// Route for http://localhost:8000/post-ad/catagory/1

Then, when you need to echo the link in your view file, you'll need to specify the second argument in route() with the category id.

<a href="{{ route('category', 1) }}">
    <img src="{{ asset('/images/car.png') }}" alt="Car" class="center-block">
</a>

rouge847 left a reply on Custom Login Redirect On Login Route After LoggedIn- How To Fix It

I'm guessing you're using auth middleware in your AdminController. To achieve what you want, you'll need to create a dedicated middleware with a redirect route to admin login page inside it.

First, create a middleware by executing php artisan make:middleware IsAdmin and check the incoming request like example code below:

public function handle($request, Closure $next)
{
    $user = $request->user();

    if (!$user)
        return redirect(route('admin.login'));

    if (!$user->admin)
        abort('403', 'You are not authorize to access this page.');
            
    return $next($request);
}

Next, you'll need to register the middleware in your app\Http\Kernel.php inside $routeMiddleware array like:

'admin' => \App\Http\Middleware\IsAdmin::class,

Finally, you can use this middleware in your AdminController in the __construct method, or defining it in your route file like:

Route::get('/admin', '[email protected]')->name('admin')->middleware('admin');

rouge847 left a reply on Shopping Cart With VueJs And Laravel Using Crinsane/LaravelShoppingcart

You can edit your page content to reflect adding item to the cart using Vue, or catch and process your endpoint response using axios.then(). These lessons might help show the basic worflow for working with Laravel & Vue.

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/32

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/33

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/37