This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { html } from 'htm/preact'; | |
| import { createContext } from 'preact'; | |
| import { useLocalStore } from 'mobx-react-lite'; | |
| export const StoreContext = createContext(undefined); | |
| export const StoreProvider = ({ children }) => { | |
| const store = useLocalStore(() => ({ | |
| counter: 0, | |
| setCounter: (number) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { html } from 'htm/preact'; | |
| import { Router } from 'preact-router'; | |
| import Header from './header'; | |
| // Code-splitting is automated for `routes` directory | |
| import Home from '../routes/home'; | |
| import Profile from '../routes/profile'; | |
| const App = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FunctionalComponent } from 'preact'; | |
| import { html } from 'htm/preact'; | |
| import { useEffect, useState } from "preact/hooks"; | |
| import style from './style.scss'; | |
| // Note: `user` comes from the URL, courtesy of our router | |
| const Profile: FunctionalComponent = (props: any) => { | |
| const { user } = props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { html } from 'htm/preact'; | |
| import style from './style.css'; | |
| import { FunctionalComponent } from 'preact'; | |
| const Home: FunctionalComponent = () => { | |
| return html` | |
| <div class="${style.home}"> | |
| <h1>Home</h1> | |
| <p>This is the Home component.</p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| 'resources/**/*.{css,js}': ['prettier --write'], | |
| '**/*.php': ['php ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --allow-risky=yes'], | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $finder = PhpCsFixer\Finder::create() | |
| ->in(__DIR__) | |
| ->exclude(['bootstrap', 'storage', 'vendor']) | |
| ->name('*.php') | |
| ->name('_ide_helper') | |
| ->notName('*.blade.php') | |
| ->ignoreDotFiles(true) | |
| ->ignoreVCS(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function store(Request $request) | |
| { | |
| DB::beginTransaction(); | |
| $user = User::create(); | |
| $response = app('service')->create($user); | |
| if (!$response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>DRY</title> | |
| </head> | |
| <body> | |
| <h1>Custom Calendar</h1> | |
| <x-custom-calendar> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Article::has('user.profile')->verified()->latest()->get(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| SELECT * | |
| FROM `articles` | |
| WHERE EXISTS (SELECT * | |
| FROM `users` | |
| WHERE `articles`.`user_id` = `users`.`id` | |
| AND EXISTS (SELECT * | |
| FROM `profiles` | |
| WHERE `profiles`.`user_id` = `users`.`id`) | |
| AND `users`.`deleted_at` IS NULL) |