How To Create Custom Artisan Commands In Laravel Super easy

How To Create Custom Artisan Commands In Laravel Super easy

Zarx Biz

4 года назад

1,165 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@charlesavul1016
@charlesavul1016 - 09.05.2024 11:41

hello bro great job.. however i dont what version of laravel this is but I'm using 10.38 and there's no default public function __construct. Please Ccn help with this?

Ответить
@SivamaniN-v7e
@SivamaniN-v7e - 03.05.2023 08:14

Awesome Video! Intersting..

Ответить
@bimbolaadeyemi31
@bimbolaadeyemi31 - 10.08.2021 18:14

bro.. dont lie.. the intro song inspiration was from a certain hub community

Ответить
@williamgalas6331
@williamgalas6331 - 19.06.2021 19:33

Nice! thanks

Ответить
@bridgesmp6709
@bridgesmp6709 - 03.03.2021 21:02

Getting an error on line 74,



C:\xampp\htdocs\bookstack>php artisan generate:sitemap

Symfony\Component\Debug\Exception\FatalThrowableError : syntax error, unexpected ')'

at C:\xampp\htdocs\bookstack\app\Console\Commands\GenerateSitemap.php:74
70| $url->segment(1) == $priorityUrl[0] ||
71| $url->segment(1) == $priorityUrl[1] ||
72| $url->segment(1) == $priorityUrl[2] ||
73|
> 74| ) {
75| $url->setPriority(1.0)
76| ->setLastModificationDate(Carbon::now());
77| } else {
78| $url->setPriority(0.8)

Exception trace:

1 Composer\Autoload\includeFile("C:\xampp\htdocs\bookstack\vendor\composer/../../app/Console/Commands/GenerateSitemap.php")
C:\xampp\htdocs\bookstack\vendor\composer\ClassLoader.php:322

2 Composer\Autoload\ClassLoader::loadClass("BookStack\Console\Commands\GenerateSitemap")
[internal]:0

Please use the argument -v to see more details.

C:\xampp\htdocs\bookstack>







After I fix the syntax error which I think is the Or sign "||" you put before closing the bracket.

I run the artisan command again and get an error on line 59





C:\xampp\htdocs\bookstack>php artisan generate:sitemap

Symfony\Component\Debug\Exception\FatalThrowableError : Class 'BookStack\Console\Commands\SitemapGenerator' not found

at C:\xampp\htdocs\bookstack\app\Console\Commands\GenerateSitemap.php:59
55| rename($this->path . $fileName, $this->path . 'sitemap-old-' . date('D-d-M-Y h-s') . '.xml');
56| }
57|
58| //Generate sitemap
> 59| SitemapGenerator::create('website url goes here')
60| ->hasCrawled(function (Url $url) {
61| //if url has these array values set priority more
62| $priorityUrl = [
63| 'archive',

Exception trace:

1 BookStack\Console\Commands\GenerateSitemap::handle()
C:\xampp\htdocs\bookstack\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36

2 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
C:\xampp\htdocs\bookstack\vendor\laravel\framework\src\Illuminate\Container\Util.php:37

Please use the argument -v to see more details.

C:\xampp\htdocs\bookstack>

Ответить