Skip to content

Instantly share code, notes, and snippets.

View mbpating's full-sized avatar

Mark Berlon A. Pating mbpating

View GitHub Profile
@mbpating
mbpating / Array.vue
Created January 5, 2022 08:47
Using Vue component in this gist link. Complete the computed property "activeItems". https://gist.github.com/anish-dcruz/1fa2af7357914750ee2e21f74db4231b .
<template>
<div class="widget">
<div v-if="activeItems && activeItems.length > 0">
<ul>
<li v-for="item in activeItems" :key="item.id">
{{ item.name }}
</li>
</ul>
</div>
</div>
@mbpating
mbpating / CustomerStoreTest.php
Created January 5, 2022 08:09
Using laravel's HTTP tests, test the CustomerController's store method, make sure to mock the mailable "WelcomeNewCustomer" using mail-fake.
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
use Illuminate\Support\Facades\Mail;
class CustomerStoreTest extends TestCase
{
public function test_customer_can_be_stored()
@mbpating
mbpating / CustomerController.php
Created January 5, 2022 07:25
Write a service class that handles saving and sending email then rewrite the store method.
<?php
namespace App\Http\Controllers;
use App\Http\Requests\CustomerRequest;
use App\Services\CustomerService;
class CustomerController extends Controller
{
public function store(CustomerRequest $request, CustomerService $service) {