mercredi 25 août 2021

Cache Management Ubuntu 18.04 LTS

I have a Laravel 5.6 (including NodeJS) application hosted on AWS cloud (Ubuntu 18 LTS) with available RAM of upto 4GB.

But I am observing the available amount of RAM decreasing due to some unknown reasons to me.

I saw the output of free -m command via terminal and the results show more than 1GB of cached data.

Could you guys illuminate me more into that as to why cache is increasing.

Can I browse to that folder if cache is being stored temporarily.

Thank You in anticipation.



via Chebli Mohamed

mardi 24 août 2021

Load model one to many relation eloquent way without primary key but on multiple overlapping fields

I'm working on an older project that I've been tasked to speed up certain parts of while we work on a complete re-write since the code is just badly maintained, poorly written and outdated for what it's suppose to do.

I stumbled into an issue to the core of the project and because of this I can't change it without breaking almost everything else. So I need to load a "relation" the eloquent way () but there isn't a real foreign ID, it rather laps with multiple fields.

Would there be a way to load it all in one query with the overlapping fields rather than have it load separately creating an n+1 problem?

+--------------+-----------------+
| Planning     | Availability    |
+--------------+-----------------+
| planning_id  | availability_id |
| date         | date            |
| startHour    | startHour       |
| stopHour     | stopHour        |
| candidate_id | candidate_id    |
| section_id   | section_id      |
+--------------+-----------------+

From the above example you can see the overlapping fields are date, startHour, stopHour, candidate_id and section_id.

I tried get...attribute but that still loads with n+1, I tried including it with ->with(['availabilities']) but that doesn't work since I ask for the model and not the relation:

return Availability::where('section_id', $this->section_id)
    ->where('candidate_id', $this->candidate_id)
    ->where('planningDate', $this->planningDate)
    ->where('startHour', $this->startHour)
    ->where('stopHour', $this->stopHour)
    ->get();


via Chebli Mohamed

lundi 23 août 2021

Laravel - Displaying json from database to view

I have a column in my database that stores json data as ["Item_1", "Item_2", "Item_3"]. It has a field - ammenities.

I would like to display the json data to my blade view?

The model:

class Property extends Model
{
   protected $casts = [
      'ammenities' => 'array',
   ];
 public function setAmmenityAttribute($value)

 {

    $this->attributes['ammenities'] = json_encode($value);

 }


  public function getAmmenityAttribute($value)

 {

    return $this->attributes['ammenities'] = json_decode($value);

 }
 }

View blade:

 <p> </p>

I get this error:

htmlspecialchars() expects parameter 1 to be string, array given


via Chebli Mohamed

How to use a clear button to clear notification screen in laravel

How to clear pop scroll bar notification using single clear button in laravel 5.5 Notification using jquery and ajax database I have crm project so i got notification like Advance slaray request approved
Live request approved. I want a clear button to clear notifiaction bar



via Chebli Mohamed

Laravel composer error -> root composer.json requires adldap2/adldap2-laravel ^6.0

I remove php 8 and I download php 7 after that I try composer update command. But when I run composer update command I have an error.

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

Problem 1 - adldap2/adldap2-laravel[v6.0.8, ..., v6.1.5] require adldap2/adldap2 ^10.1 -> satisfiable by adldap2/adldap2[v10.1.0, ..., v10.3.3]. - adldap2/adldap2-laravel[v6.0.0, ..., v6.0.7] require adldap2/adldap2 ^10.0 -> satisfiable by adldap2/adldap2[v10.0.0, ..., v10.3.3]. - adldap2/adldap2[v10.0.0, ..., v10.3.3] require ext-ldap * -> it is missing from your system. Install or enable PHP's ldap extension. - Root composer.json requires adldap2/adldap2-laravel ^6.0 -> satisfiable by adldap2/adldap2-laravel[v6.0.0, ..., v6.1.5].

To enable extensions, verify that they are enabled in your .ini files: - C:\xampp\php\php.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.



via Chebli Mohamed

how to search a file by using file name in google drive using laravel plugin nao-pon/flysystem-google-drive

I'm able to find the file name by using the file id but i need to get the file object data by using the file name in the google drive folder

Code here



via Chebli Mohamed

Google Drive : File Uploading and Accessing the files

Can anyone help me the google drive [long term validity] refresh token,

  1. Refresh token getting expired every week, we wanted to fix and the refresh token permanently.
  2. Google project status is internal,application status
  3. using Laravel package : nao-pon/flysystem-google-drive
  4. Using Laravel Application.

Please Help me through this, Thanks in Advance.



via Chebli Mohamed