julian-gamboa-ensino / curso-php-chile

1 stars 0 forks source link

receitas cheat sheet #4

Open julian-gamboa-ensino opened 4 months ago

julian-gamboa-ensino commented 4 months ago

Criando uma API:


laravel new api-julian
cd api-julian
php artisan serve &
curl http://localhost:8000/
composer require laravel/ui
php artisan ui vue --auth

npm install && npm run dev

image

julian-gamboa-ensino commented 4 months ago

Writing Vue Components

Fonte: https://github.com/laravel/ui

When using the laravel/ui package to scaffold your frontend, an ExampleComponent.vue Vue component will be placed in the resources/js/components directory. The ExampleComponent.vue file is an example of a single file Vue component which defines its JavaScript and HTML template in the same file. Single file components provide a very convenient approach to building JavaScript driven applications. The example component is registered in your app.js file:

import ExampleComponent from './components/ExampleComponent.vue';
Vue.component('example-component', ExampleComponent);

To use the component in your application, you may drop it into one of your HTML templates. For example, after running the php artisan ui vue --auth Artisan command to scaffold your application's authentication and registration screens, you could drop the component into the home.blade.php Blade template:

@extends('layouts.app')

@section('content')
    <example-component></example-component>
@endsection

Remember, you should run the npm run dev command each time you change a Vue component. Or, you may run the npm run watch command to monitor and automatically recompile your components each time they are modified.

If you are interested in learning more about writing Vue components, you should read the Vue documentation, which provides a thorough, easy-to-read overview of the entire Vue framework.

julian-gamboa-ensino commented 4 months ago

Vue já configurado:

composer create-project --prefer-dist laravel/laravel my-laravel-breeze-app && \
cd my-laravel-breeze-app && \
composer require laravel/breeze --dev && \
php artisan breeze:install && \
php artisan migrate && \
npm install && npm run dev && \
php artisan serve