Laravel 10 + Sail + Breeze: Tailwind missing classes - laravel

In a brand new Laravel 10 project, based on the Breeze blade starter theme, I simply try to change the text color on the welcome screen, but it does not work.
I replace in welcome.blade.phpat one of the paragraphs text-gray-500 with text-blue-500, and expect to see blue text.
Instead, the browser renders the text in its default black, because the text-blue-500css class does not exist. I expected the Vite server, which is running in the background, to take care of this... What am I missing here?
To reproduce under Linux, simply run this:
curl -s https://laravel.build/l10 | bash
cd l10
./vendor/bin/sail up -d
./vendor/bin/sail composer require laravel/breeze --dev
./vendor/bin/sail artisan breeze:install
# Now select 0 for Blade, and No, No for the other 2 questions
./vendor/bin/sail artisan migrate
./vendor/bin/sail npm i
./vendor/bin/sail npm run dev
Changing the styles with classes that already exist in the template is no problem, but adding in new Tailwind classes does not work.
Also, when running ./vendor/bin/sail npm run build, I can see that a css file is created under public/build/assets, and that file actually includes the text-blue-500 class. However that file does not seem to be used on the localhost server...
When using the Vue template, and making that same color change in the Welcome.vue file, it works without any issue.

Related

Laravel 5.7 create empty project

i've worked with with 5.4, but i'm lost since 5.7 version.
When in want to start a new project i've lot of features like Authentification already generated and some javascript stuff with webpack and Vue.js
And by default, i see that '/' url is protected by authenfication middleware.
laravel list command print
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
new Create a new Laravel application.
But what's if i just want a minimalist project ?
I doesn't want to create an API, so i doesn't want Lumen. Just create an application with the possibility to use authentification scaffold, templeting engine blade and let me configure webpack myself without vue.js by default if i want to use react with typescript by example.
Since Laravel 6 you can add UI and auth as additional option.
laravel new abc
composer require laravel/ui
php artisan ui [bootstrap, vue, react] --auth
Please, look for it to documentation:
https://laravel.com/docs/6.x/frontend

Is NetBeans not accepting _ide_helper from Laravel?

Using NetBeans 8.2 with Laravel, I'm setting the _ide_helper.php to my project as described in his link https://github.com/barryvdh/laravel-ide-helper,
it was set on terminal the command
composer require barryvdh/laravel-ide-helper
then after, it was added into config/app.php the line
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
and for last, the command on the project folder
php artisan ide-helper:generate
but nothing has changed apparently. No auto complete, no references. Here are some images comparing what is expected and what is happening.
Expected
Happening
Plus, NetBeans is marking an error inside the ide_helper file which confuses the syntax by the name of the function ('if'). I'll put an image of the part showing the error
Error_NetBeans_ide_helper
I've rebooted NetBeans, tried downloading and setting directly the file, but no lucky. Is the function 'if' causing the problem? Or is NetBeans not accepting the _ide_helper?

Cannot make command line tool for artisan in PhpStorm 2017.1.3

I got this error message when I tried to make an alias for artisan: [Settings | Tools | Command Line Tool Support ] -> add -> tool based on Symfony Console.
Problem:
Failed to parse output as xml: Error on line 3: Content is not allowed
in prolog..
Command:
C:\xampp\php\php.exe C:\xampp\htdocs\artisan list --format=xml
Output:
[Symfony\Component\HttpKernel\Exception\NotFoundHttpException]
Even when I try artisan serve or composer install,
then [Symfony\Component\HttpKernel\Exception\NotFoundHttpException] bug is occured.
I don't find any solution for this.
I'm using Laravel 5.2 + Angular 1.
I had recently issues running artisan commands (ide-helper for example) directly in phpstorm, I'd recommend you to use your OS terminal instead. It might help you.

Laravel 5.4: What is the best way to create routes based on user logged in or logged out

So, I have an API endpoint /api/v1/xxx that calls a single controller and method.
In the routes/api.php I have added the following logic
if (Auth::guard('api')->guest()) {
Route::post('xxx', 'API\v1\XXController#xx');
} else {
Route::post('xxx', 'API\v1\XXController#xx')->middleware('auth:api');
}
Everything works except when I run composer install, I get the following error:
a#b /var/www/html/test/app13 $ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
[LogicException]
Key path "file:///var/www/html/test/app13/storage/oauth-public.key" does not exist or is not readable
Script php artisan optimize handling the post-install-cmd event returned with error code 1
Removing the lines in routes/api.php does not output that ^ error when I run composer install.
What am I doing wrong?
Thanks for any help.
Key path "file:///var/www/html/test/app13/storage/oauth-public.key" does not exist or is not readable
This above lines says everything, you have laravel/passport installed and enabled but you forget to generate the key,
run command
php artisan passport:install
and it will work just fine.

How to use artisan to make views in laravel 5.1

I have been looking in the docs for a solution to make views with basic CURD operations but without much success.
I guess this might be pretty simple, but am missing something or not looking hard enough.
i can make models and controllers using the below artisan commands
php artisan make:model modelName
php artisan make:controller controllerName
But how do we make the basic CURD views. something like
php artisan make:views
cant find any doc for this. Please help
At the time of writing, there isn't a way to create views via artisan without writing your own command or using a third party package. You could write your own as already suggested or use sven/artisan-view.
if you are using laravel 5.1 or 5.2 this gist can help you make:view command just create command copy and paste the code from gist.
Step 1:
php artisan make:command MakeViewCommand
Step 2:
copy class from this gist
https://gist.github.com/umefarooq/ebc617dbf88260db1448
Laravel officially doesn't have any Artisan cammands for views.
But you could add third party plugins like Artisan View
Here's the link Artisan View
After adding this plugin to your project by the guide provided here you should be able to perform following cammands :
Create a view 'index.blade.php' in the default directory
$ php artisan make:view index
Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index
Create a view with a different file extension ('index.html')
$ php artisan make:view index --extension=html
There is very easy way to create a view(blade) file with php artisan make:view {view-name} command using Laravel More Command Package.
First Install Laravel More Command
composer require theanik/laravel-more-command --dev
Then Run
php artisan make:view {view-name}
For example
It create index.blade.php in resource/views directory
php artisan make:view index
It create index.blade.php in resource/views/user directory
php artisan make:view user/index
Thank you.
In v5.4 you need to create the command with:
php artisan make:command MakeView
and before you can use it, it must be registered in App/Console/Kernel like
protected $commands = [
Commands\MakeView::class
];
then you make a view like: php artisan make:view posts/create
To create a view (blade) file through command in laravel 8:
composer require theanik/laravel-more-command --dev
php artisan make:view abc.blade.php
You can install sven/artisan-view package to make view from CMD, to install package write this command:
composer require sven/artisan-view --dev
After installing it, you can make a single view or folder with all views that contain {index-create-update-show}
To make a single file we using this command:
php artisan make:view Name_of_view
For example
php artisan make:view index
To make a folder that contain all resources index - create - update - show write name of folder that contain all this files for example:
php artisan make:view Name_of_Folder -r
For example:
php artisan make:view blog -r
-r is a shorthand for --resource you can write full name or shorthand to make resource.
you can extend yields from master page if master page inside in directory layouts we write command sith this format
php artisan make:view index --extends=layouts.master --with-yields
layouts is a directory this directory may be with a different name in your project the idea is name_of_folder/master_page that you want to extend yields from it.
For more view docs

Resources