dimanche 12 novembre 2023

Laravel project code not refelcting changes to view files

I created a laravel(5.1.3) project with breeze as the starter kit. I am planning to use the react as frontend to this project. I run the 'php artisan serve' command. The boiler plate template is working but any changes to files /resources/js/Pages/Welcome.jsx or /resources/views/welcome.blade.php is not reflecting. I have tried

  1. clearing the storage/framework/views folder ,
  2. run command php artisan view:clear ,
  3. run command php artisan config:clear ,
  4. run command composer dump-autoload ,

Still no change to the initial view. What am I doing wrong?

And I configured to make react as frontend library so I don't need the welcome.blade.php file right?



via Chebli Mohamed

samedi 11 novembre 2023

How to send multiple data from view to controller laravel

i want to send data from view to controller ..i.e. 1st card click send id =5 , 2nd card click send id = 6 etc...I can't find answer anywhere on google ...any help will be appreciated...thanks

i tried sendind the variable even aaray by form ..but i am not able to get the desired output.As i said i want to send data on card conditions ..for card 1 send id = 5 , card 2 send id = 6 ..so on

Here is my Code ...

@foreach ($role as $d)
      <form class="form-signin" id="agentPassword" method="POST" action="">
         
        <div class="card_dash card-1" onClick='submitDetailsForm()'>
          <h3>    
          
          <img src="/assets_web/app-icon/icon/web-icon/bix42_" id="role" alt="img">
            <input type="hidden" name="roleInfo[]" value="">
            <!-- <input type="hidden" name="role" value=""> -->
          </h3>
        </div>
      </form>
      @endforeach

the id value in already in $d[1] ...its even better if i can send the whole array $d.



via Chebli Mohamed

Hii i am create a new laravel project in laravel 5.1.3 version and my php version is 8.2.12.please help me to solve this errors

Problem 1 - laravel/framework[v10.10.0, ..., v10.31.0] require league/flysystem ^3.8.0 -> satisfiable by league/flysystem[3.8.0, ..., 3.19.0]. - league/flysystem[3.3.0, ..., 3.14.0] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.14.0]. - league/flysystem[3.15.0, ..., 3.19.0] require league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.15.0, 3.16.0, 3.18.0, 3.19.0]. - league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.2.12) does not satisfy that requirement. - league/mime-type-detection[1.4.0, ..., 1.14.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - league/flysystem-local[3.15.0, ..., 3.19.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - Root composer.json requires laravel/framework ^10.10 -> satisfiable by laravel/framework[v10.10.0, ..., v10.31.0].

To enable extensions, verify that they are enabled in your .ini files: - C:\Program Files\php-8.2.12\php.ini

Hii i am create a new laravel project in laravel 5.1.3 version and my php version is 8.2.12.please help me to solve this errors. i have enabled the file-info extension then also same error.



via Chebli Mohamed

dimanche 5 novembre 2023

Get all children categories of a collection of categories without using foreach in Laravel

so I have this codes in my Category model. What it does is, you give it a single category collection and it will return all children category ids of that category in a one dimensional array of ids that can be used in a whereIn query.

private $descendants = [];

public function subcategories()
    {
      return $this->hasMany(Category::class, 'parent_id');
    }

public function children()
    {
        return $this->subcategories()->with('children');
    }

public function hasChildren(){
        if($this->children->count()){
            return true;
        }

        return false;
    }

public function findDescendants(Category $category){
        $this->descendants[] = $category->id;

        if($category->hasChildren()){
            foreach($category->children as $child){
                $this->findDescendants($child);
            }
        }
    }

public function getDescendants(Category $category){
        $this->findDescendants($category);
        return $this->descendants;
}

Usage:

$category = Category::where('id',$id)->first();
$children_ids = [];
$children_ids = $category->getDescendants($category);

It works. It is very useful in my filter. But when it comes to getting children ids of multiple categories, I had to use foreach loop and I had to call getDescendants multiple times thus creating multiple queries. What I want to accomplish are:

  1. To improve performance how to do it in a single query without the need of using foreach loop? Where I want to feed it not just a single category but a collection of categories, and then it should return all children category ids of those categories.
  2. How to return not just children ids but entire collection of children categories?

What usage I had in mind (please feel free to suggest a better approach)

Getting children ids from category collections:

$category = Category::where('parent_id',$id)->get();
$children_ids = [];
$children_ids = $category->getDescendants($category);

Getting children collection from category collections.

$category = Category::where('parent_id',$id)->get();
$children_ids = [];
$children_ids = $category->getDescendants($category);

Please help me accomplish this. Thank you.



via Chebli Mohamed

display students data rank wise as similar to e-commerce website [closed]

I have to display the data of students as it is shown in e-commerce website like amazon. First image of the student, then below it name and then the rank of the student. The number of students is dynamic. I am fetching it from database. But how can I present data in such fashion without using html table. Is there any other way to present data row column format without using table? How can I do it in Laravel?



via Chebli Mohamed

mercredi 1 novembre 2023

header style with EASY DATATABLE VUE 3

I'm experiencing difficulties with the table header's appearance, as shown in the picture. It doesn't match the desired style. Can you assist me in resolving this issue? enter image description here i try using easy data table css, but he dosen't work (https://i.stack.imgur.com/7hdwt.png)



via Chebli Mohamed