jeudi 21 juillet 2022

'View [] not found' only with Laravel Command

I have an application which has a command scheduled to run every minute to update catalogs status and it should send an email upon a new book being found, somehow when the mailer sends the email it triggers the 'View not found'.

The Laravel Command has a function that calls another function in a controller. However when a route is made pointing to the same controller it works fine i.e sends an email.

It is only when the controller func is called from the Command that it doesn't find the email template view file.

The view file is present as it runs correctly when the route is used.

Any idea what amendments I need in my command?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/8SdnjV7
via IFTTT

Compare array and object in php without foreach [closed]

I want to compare arrays and objects in my PHP website. Currently, I am using foreach for comparison. But, it takes a long time for heavy data.

Is any other ways to compare array and object?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/O2SvT6x
via IFTTT

mercredi 20 juillet 2022

How to update IMAGE in laravel?

I have tried many ways to update image but its not working at all though I can update other data except image.

code for saving Image and other inputs

 public function store(Request $request)
{

    $fileName = null;
    if($request->file('image')){
        $fileName = strtotime(Carbon::now());
        $fileName = $fileName.".".$request->file('image')->extension();
        $uploadPath = (public_path($this->uploadPath."/".$fileName));
        move_uploaded_file($request->file('image'), $uploadPath);
    }
        $data = $request->all();
        $data['image'] = $fileName;
    if(Covidrecord::create($data))
    {
        return redirect()->route('store')->with(['msg'=>"User create successfully"]);
        return redirect()->route('store')->withError(['msg'=>"User cannot be registerd at the moment"]);

    }
}

Code for UPDATING

  public function update(Request $request,Covidrecord $covidrecord, $id)
    {
        $data = Covidrecord::find($id);

    $fileName = null;
    if($request->file('image')){
        $fileName = strtotime(Carbon::now());
        $fileName = $fileName.".".$request->file('image')->extension();
        $uploadPath = (public_path($this->uploadPath."/".$fileName));
        move_uploaded_file($request->file('image'), $uploadPath);
    }
        $data = $request->all();
        $data['image'] = $fileName;
        $covidrecord->update($request->all());

        return redirect()->route('allrecord')->with(['msg'=>"User create successfully"]);

}

Blade

 <div class="input-group">
  <input class="form-control" type="file" placeholder="Upload Image" name="image" >
   <img src=""
   </div>
   </div>


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/v8bzkKQ
via IFTTT

Laravel 5.6 Error on clicking the Patient list when creating a new doctor account

question 1.I have a thesis project about a certain clinic, I have a default users in my database, The default doctor doesn't have any problems or errors, but when i create a new doctor account, and when i click the patient list I get this error

Undefined variable: patient (View:C:\Users\patri\OneDrive\Desktop\Megason_noOTP\resources\views\patient-management\list.blade.php)

Please help TIA!!

    enter code here


public function index(){
    $user = User::where('id', Auth::user()->id)->with('usertype','usertype.permissions')->get();
    $permissions = [];
    foreach($user[0]->usertype->permissions as $permission)
    {
        array_push($permissions, $permission->name);
    }

    $patients = $this->getPatients();

    $data = array(
        'permissions' => $permissions,
        'patients' => $patients
    );

    return view('patient-management.list')->with('data',$data);

}

public function getPatients(){
    if(Auth::user()->type == 2){
        return PatientDetail::where('doctor_id', Auth::user()->id)->with('doctor.doctorDetails','user')->get();
    }else if(Auth::user()->type == 3){
        return PatientDetail::where('user_id', Auth::user()->id)->with('doctor.doctorDetails','user')->get();
    }
    else{
        return PatientDetail::with('doctor.doctorDetails','user')->get();
    }
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/seHhpvR
via IFTTT

dimanche 17 juillet 2022

curl error 28 while downloading https://ift.tt/6KiglMT Connection timeout after 10004 ms

enter image description here

I have a problem installing a Laravel project, any help please



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/1LzOuBX
via IFTTT

https://ift.tt/rIUp0kx could not be fully loaded (The "https://ift.tt/lRLHa5B" file could not be downloaded: failed to open

I have problems installing any Laravel project

I don't know what the problem is, but I tried to update the composer, but the problem persists



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/KEqtNWS
via IFTTT

vendredi 15 juillet 2022

laravel products with the highest sales will be displayed at the top

I am trying to sort products with the highest sales will be displayed at the top. Do I need to improve it? or is it correct enough to get sorted products with highest sales?

Here is my sort query

    $data = Product::query();
    if ($category_id) {
        $data->where('category_id', $category_id);
    }
    if ($theme_id) {
        $data->Where('theme_id', 'LIKE', '%' . $theme_id . '%');
    }
    if ($sub_category_id) {
        $data->where('sub_category_id', $sub_category_id);
    }

    $data = $data->leftJoin('order_items', function ($join) {
              $join->on('products.id', '=', 'order_items.product_id');
    })
    ->selectRaw('products.*, sum(order_items.id) as total')
    ->groupBy('products.id')
    ->orderByDesc('total');

    $products = excludeProductLessThanZero($data->paginate($this->paginationcount));

products table

enter image description here

**Orders table**

enter image description here

**order_items**

enter image description here

All three tables database structure is given above. Please guide and suggested. Thanks



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/Gn72pcd
via IFTTT