in laravel 5.4 make:mail not exists - email

D:\xampp\htdocs\blog>php artisan make:mail Waleed
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "make:mail" is not defined.
Did you mean one of these?
make:model
make:provider
make:policy
make:request
make:seeder
make:migration
make:test
make:middleware
make:controller
make:console
make:event
make:job
make:listener
make:auth

Related

Laravel 9.48.0 + PHP 8.1.6 in VSCode shows syntax error

i have win10
in cmd.exe with composer create project:
composer create-project laravel/laravel firstproject
or(laravel new firstproject)
then:
php artisan serve
but in vscode i have some syntax error in vendor folder
list of errors:
Syntax error:unexpected token 'string' php(php2014)
Syntax error:unexpected token 'array' php(php2014)
...
in AppData\Roaming\Code\User\setting.json
"intelephense.environment.phpVersion": "8.1.6"
how can i fix errors?

PostGIS: function ST_AsRaster does not exist. Even using examples from the docs

I'm trying to convert geometries to images, and the functions to do so don't seem to exist.
The following example is from the ST_AsRaster Docs WHich specify the requirements are Availability: 2.0.0 - requires GDAL >= 1.6.0.
SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150, 150));
This results in:
ERROR: function st_asraster(geometry, integer, integer) does not exist
LINE 1: SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150,...
I found some info that points towards needing GDAL drivers, however, when I try:
SELECT short_name, long_name FROM ST_GdalDrivers();
I get:
ERROR: function st_gdaldrivers() does not exist
LINE 1: SELECT short_name, long_name FROM ST_GdalDrivers();
I have no idea where to even go to try solving this, why don't the functions exist, was there some config I needed to add, some doc I didn't read?
Even the https://postgis.net/docs/RT_reference.html seems to suggest that it should "just work"?
This is installed from the package manager on Ubuntu 20.0.4.
Version Info SELECT PostGIS_Full_Version();:
POSTGIS="3.0.0 r17983" [EXTENSION]
PGSQL="120"
GEOS="3.8.0-CAPI-1.13.1 "
PROJ="6.3.1"
LIBXML="2.9.4"
LIBJSON="0.13.1"
LIBPROTOBUF="1.3.3"
WAGYU="0.4.3 (Internal)"
You must have forgotten to install the postgis_raster extension:
CREATE EXTENSION postgis_raster;
This extension is new in PostGIS 3.0; before that, its objects were part of the postgis extension.
The documentation mentions that:
Once postgis is installed, it needs to be enabled in each individual database you want to use it in.
psql -d yourdatabase -c "CREATE EXTENSION postgis;"
-- if you built with raster support and want to install it --
psql -d yourdatabase -c "CREATE EXTENSION postgis_raster;"

Symfony 5 Parse error: syntax error, unexpected '?' In C:\Users\public\index.php on line 15

I try to start a new project symfony 5 simple. When I start the server "symfony server: start", I have this answer:
Parse error: syntax error, unexpected '?' In C:\Users\Philippe\Documents\my_project_name\public\index.php on line 15.
I have windws 10, PHP 7.4.3, wamp server but its off.
I show you my terminal:
Answer is simple php5.6 does not support Null coalescing operator (??). This operator is available from PHP7+ (php.net)
Solution 1:
Upgrade your PHP version to ^7
Solution 2:
Change code
PHP 7+ $username = $loggedUser ?? 'nobody';
PHP 5.6 $username = isset($loggedUser) ? $loggedUser : 'nobody';
both is equivalent, return logged user if set, otherwise nobody.
It says in the output that you are running "PHP cgi v5.6.40". Run symfony local:php:list and see what is available to be able to be run. You need to install PHP 7.4 as php-fpm (if available on WAMP), or php-cgi. The Symfony Server can't use the cli version to run webpages.
symfony local:php:refresh may also help, or install other versions of PHP.
> symfony local:php:list
# You'll see all supported SAPIs (CGI, FastCGI, etc.) for each version.
# FastCGI (php-fpm) is used when possible; then CGI (which acts as a FastCGI
# server as well), and finally, the server falls back to plain CGI.
from: https://symfony.com/doc/current/setup/symfony_server.html#selecting-a-different-php-version

Multi-theme (nginx server) specific theme css, js not loading

Very strange issue, one specific (multi-store) theme css and js are not loading. The server is "nginx". I run multiple times below static-content command.
php -dmemory_limit=-1 bin/magento setup:static-content:deploy --theme Test/testdealer en_US -f
Other stores are working fine except Test/testdealer
Please help.
If multi-stores, then please define the correct language "locale", while running static-content deploy command.
Please verify the store "locale" via:
admin->stores->configuration->select store-view->general->general->locale options->locale (store view)...
If locale is "English (Australia)", then static-content command must be:
php -dmemory_limit=-1 bin/magento setup:static-content:deploy --theme Test/testdealer en_AU -f
Thanks,

How to add my own custom class in Laravel 5?

Ok, in laravel 4, if I want to add my own custom class, eg : library\myFunction.php then I do the following steps :
add "myFunctions.php" into app/library/myFunctiosn.php
at app/start/global.php , within ClassLoader::addDirectories(array( , I add app_path().'/library',
And to call it within my blade view, I add the following codes
<?php
$FmyFunctions1 = new myFunctions;
$is_ok1=($FmyFunctions1->is_ok());
?>
The contents of app/library/myFunctions.php is :
<?php namespace App\library {
class myFunctions {
public function is_ok() {
return 'myFunction is OK';
}
}
}
?>
And it works.
But how to do so in Laravel 5 ???
PS : I read What are the best practices and best places for laravel 4 helpers or basic functions?
And tried to add "app/library/", to the autoload array and run composer dum-autoload , but it keeps give me error :
FatalErrorException in xxxx line xx: Class 'myFunctions' not found
I'm also already trying to use :
composer update
composer dump-autoload
php artisan dump
php artisan clear-compiled
php artisan dump-autoload
php artisan optimize
php artisan route:clear
php artisan route:scan
php artisan route:list
But still doesn't work...
This should help you.
FYI:
Basically, you could create another directory within app, and then namespace your files in there as appropriate:
app/CustomStuff/CustomDirectory/SomeClass.php.
Then, within your SomeClass.php, make sure you namespace it:
<?php
namespace App\CustomStuff\CustomDirectory;
class Someclass {}
Now, you can access this class using the namespace within your classes:
use App\CustomStuff\CustomDirectory\SomeClass;
After some trial and error, I found the answer.
There is no need to modify Composer. Just modify the Blade into:
<?php
$FmyFunctions1 = new \App\library\myFunctions;
$is_ok = ($FmyFunctions1->is_ok());
?>