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
Related
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.
I create a command through make:command
php artisan make:command ResetDBCommand
Then I would like to run the two command in handler
php artisan ide:models
php artisan db:seed
However, it's not work for me to fire the two command automatically through the below codes
Artisan::call('db:seed');
$console->writeln('db:seed done.');
Artisan::call('ide:models--force');
$console->writeln('ide:models done.');
Error:
The command "ide:models--force" does not exist.
how can I do that?
The correct command is ide-helper:models you can confirm this if you do:
php artisan help ide:models
You get:
[...]
Usage:
ide-helper:models [options] [--] [<model>...]
which indicates that Laravel does automatically resolve this command when called in the command line. However such resolution mechanism does not exist when calling it programmatically.
Another issue is that --force is not a valid option in ide-helper:models here's what you can do though:
Artisan::call('db:seed');
$console->writeln('db:seed done.');
// Uncomment one of the two
// Artisan::call('ide-helper:models --nowrite'); // Only write metadata in the _ide_helper_models.php file
// Artisan::call('ide-helper:models --write'); // Write metadata on models
// ------
$console->writeln('ide:models done.');
Pick whichever one you prefer accordingly
Tested the above in Laravel 8
As the title says; is there a way to delete/revert/rollback the creation of the files created when running php artisan make:model MyModel -mcr?
Something like:
php artisan destroy:model MyModel
.. and it "cascade" delete all related files?
Just do it manually, no command as of this writing
Delete the model first (if you don't) need the model any longer
Delete the migration from ...database/migrations folder
If you have already migrated i.e if you have already run php artisan migrate, log into your phpmyadmin or SQL(whichever the case is) and in your database, delete the table created by the migration
Still within your database, in the migrations folder, locate the row with that migration file name and delete the row.
Works for me, hope it helps!
When you run
php artisan make:model --help
command you must be see
Usage:
make:model [options] [--] <name>
Arguments:
name The name of the class
Options:
-a, --all Generate a migration, factory, and resource controller for the model
-c, --controller Create a new controller for the model
-f, --factory Create a new factory for the model
--force Create the class even if the model already exists
-m, --migration Create a new migration file for the model
-p, --pivot Indicates if the generated model should be a custom intermediate table model
-r, --resource Indicates if the generated controller should be a resource controller
-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
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
ut and 3 for debug
That mean dy default it is not poosible. You must be make your own artisan command for it. Also if you want know about artisan command options and arguments use
php artisan command_name --help
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.
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.