vendredi 18 décembre 2020

can't validate true or false var_dump in laravel carbon

I write code to check current time between 2 times $start and $end like this:

$current = new Carbon();
$start = product::select('dateS')->where('id',$req->id)->first(); 
$end = product::select('dateE')->where('id',$req->id)->first();
$val= var_dump($current->between($start->dateS,  $end->dateE));

It work and when i use dd($val) it will show:

bool(false) null or bool(true) null

Next, i want to do like this but it only returns else case. What did I do wrong?

 if($val == true){
      echo "current time is between start and end";
    }
    else{
      echo "current time isn't between start and end";
    }


via Chebli Mohamed

jeudi 17 décembre 2020

Why Laravel do not works

I've got a little problem, I can not run Laravel on my Mac OS X (the version of my Laravel is 5.4 PHP 7.3 and the error appears below.

(3/3) ErrorException
compact(): Undefined variable: operator (View: /Users/marques/Sites/barramento/resources/views/layouts/template.blade.php) (View: /Users/marques/Sites/barramento/resources/views/layouts/template.blade.php)

enter image description here



via Chebli Mohamed

AWS RDS is not connecting with laravel ec2 intance

I have create laravel rds mysql database but not that rds database is not connecting with ec2 instance laravel project . it is giving this error

 SQLSTATE[HY000] [2002] Connection timed out (SQL: select * from information_schema.tables where table_schema = asfalconsd and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675|

      +36 vendor frames
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

I have gave credentials in env file but still i think there is any kind of configuration is missing . May be Inboud rule etc but i dont know how to set it up



via Chebli Mohamed

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0"

I have uploaded my laravel project to aws hosting when I go to ip address of ec2 instance it give me this error

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0".

I check php version current version 7.3 I dont know what actually need to do . First the version was 7.4 then i downgrade it to 7.3



via Chebli Mohamed

file_put_contents(C:\xampp\htdocs\academy\storage\framework/sessions/yYtLcWMJlFDNXQf3lfs5P): failed to open stream: No such file or directory

When i try to run a software devolved i laravel frame work it is showing this error. I have installed composer,php every thing. Database is created and when i give command in power shell it is showing server started but when i try to open it through crome it give me this error.enter image description here

file_put_contents(C:\xampp\htdocs\academy\storage\framework/sessions/yYtLcWMJlFDNXQf3lfs5Pfv0ImwmiwjvhW8Oxkyy): failed to open stream: No such file or directory



via Chebli Mohamed

Not install required extensions on ubuntu

I am using aws ubuntu server for hosting laravel website . When I run Composer install command it gives this error

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet[1.14.0, ..., 1.15.0] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
    - Root composer.json requires phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.0, 1.14.1, 1.15.0].

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.4/cli/php.ini
    - /etc/php/7.4/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.4/cli/conf.d/10-opcache.ini
    - /etc/php/7.4/cli/conf.d/10-pdo.ini
    - /etc/php/7.4/cli/conf.d/20-calendar.ini
    - /etc/php/7.4/cli/conf.d/20-ctype.ini
    - /etc/php/7.4/cli/conf.d/20-exif.ini
    - /etc/php/7.4/cli/conf.d/20-ffi.ini
    - /etc/php/7.4/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.4/cli/conf.d/20-ftp.ini
    - /etc/php/7.4/cli/conf.d/20-gettext.ini
    - /etc/php/7.4/cli/conf.d/20-iconv.ini
    - /etc/php/7.4/cli/conf.d/20-json.ini
    - /etc/php/7.4/cli/conf.d/20-mbstring.ini
    - /etc/php/7.4/cli/conf.d/20-mysqli.ini
    - /etc/php/7.4/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.4/cli/conf.d/20-phar.ini
    - /etc/php/7.4/cli/conf.d/20-posix.ini
    - /etc/php/7.4/cli/conf.d/20-readline.ini
    - /etc/php/7.4/cli/conf.d/20-shmop.ini
    - /etc/php/7.4/cli/conf.d/20-sockets.ini
    - /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.4/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.4/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.4/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Here is conf.d directory



ubuntu@ip-172-31-8-137:/etc/php/7.4/cli/conf.d$ ls
10-mysqlnd.ini   20-ffi.ini       20-mbstring.ini   20-shmop.ini
10-opcache.ini   20-fileinfo.ini  20-mysqli.ini     20-sockets.ini
10-pdo.ini       20-ftp.ini       20-pdo_mysql.ini  20-sysvmsg.ini
20-calendar.ini  20-gettext.ini   20-phar.ini       20-sysvsem.ini
20-ctype.ini     20-iconv.ini     20-posix.ini      20-sysvshm.ini
20-exif.ini      20-json.ini      20-readline.ini   20-tokenizer.ini



via Chebli Mohamed

Array ( [type] => 64 [message] => require(): Failed opening required '' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear')

This type of error is showing in my laravel website.

Array ( [type] => 64 [message] => require(): Failed opening required '' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') [file] => /home/kafesta/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php [line] => 72 )



via Chebli Mohamed