Laravel admin panel blank page and not responding [closed]

I’m having a problem in the admin panel. This is the first time it happens to me and I can’t find the solution. Admin panel is connected to database. When I add an article from the admin panel, I encounter a blank page. I will add the photos to the description.

This is the part where I update and add articles and so on in the admin panel:
admin panel image

As soon as I press the save button, a blank page appears. Normally, a green warning should appear before me.
after save image

The green warning that will appear is as follows, but it definitely does not appear.
success warning

I am attaching the backend codes below.

This is index.blade.php code screen.

@extends('backend.app')
@section('content')
    <div class="m-alert m-alert--icon m-alert--air m-alert--square alert alert-dismissible m--margin-bottom-30" role="alert">
        <div class="m-alert__icon">
            <i class="flaticon-exclamation m--font-brand"></i>
        </div>
        <div class="m-alert__text">
            Bu bölümden sitenizin haberlerini yönetebilirsiniz.
        </div>
    </div>
    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__head">
            <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                    Haberler
                    </h3>
                </div>
            </div>
        </div>
        <div class="m-portlet__body">
    <!--begin: Search Form -->
    <div class="m-form m-form--label-align-right m--margin-top-20 m--margin-bottom-30">
        <div class="row align-datas-center">
            <div class="col-xl-8 order-2 order-xl-1">
                <div class="form-group m-form__group row align-datas-center">
                    <div class="col-md-4">
                        <div class="m-input-icon m-input-icon--left">
                            <input type="text" class="form-control m-input" placeholder="Search..." id="generalSearch">
                            <span class="m-input-icon__icon m-input-icon__icon--left">
                                <span>
                                    <i class="la la-search"></i>
                                </span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xl-4 order-1 order-xl-2 m--align-right">
                <a href="{!! url('admin/news/trash') !!}" class="btn btn-danger m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
                    <span>
                        <i class="la la-trash"></i>
                        <span>
                            Çöp kutusu
                        </span>
                    </span>
                </a>
                <a href="{!! route('news.create') !!}" class="btn btn-primary m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
                    <span>
                        <i class="la la-plus"></i>
                        <span>
                            Yeni
                        </span>
                    </span>
                </a>

                <div class="m-separator m-separator--dashed d-xl-none"></div>
            </div>
        </div>
    </div>
    <!--end: Search Form -->
    <!--begin: Datatable -->
    <table class="m-datatable" id="html_table" width="100%">
        <thead>
            <tr>
                <th>
                    ID
                </th>
                
                <th>
                    Haber
                </th>
                <th>
                    Oluşturma Tarihi
                </th>
                <th>
                    Düzenlenme Tarihi
                </th>
                <th>
                    Status
                </th>
                <th>
                    İşlemler
                </th>
                
            </tr>
        </thead>
        <tbody>
            @foreach($datas as $data)
            <tr>
                <td>
                    {{ $data->id }}
                </td>
                <td>
                    {{ $data->title }}
                </td>
                <td>
                    {{ $data->created_at }}
                </td>
                <td>
                    {{ $data->updated_at }}
                </td>
                <td>
                    @if($data->status=='active') 4 @else 6 @endif
                </td>
                <td data-field="Actions" class="m-datatable__cell">
                    <span style="overflow: visible; position: relative; width: 110px;">
                        
                        <a href="{!! url('admin/news/'.$data->id.'/edit/') !!}" class="pull-left m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill" title="Düzenle"><i class="la la-edit"></i></a>

                        {!! Form::open(['method' => 'Delete', 'route' => ['news.destroy', $data->id], 'id'=> 'deleteID'.$data->id ]) !!}
                        <button type="submit" value="deleteID{{$data->id}}" class="delete m-portlet__nav-link btn m-btn m-btn--hover-danger m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></button>
                        {!! Form::close() !!}

                    </span>
                </td>
            </tr>
            @endforeach
        </tbody>
    </table>

    <!--end: Datatable -->
</div>
    </div>

@section('js')
    <script src="/backend/assets/demo/default/custom/header/actions.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/forms/widgets/bootstrap-switch.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/base/sweetalert2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.delete').click(function(){
                var action = "#" + $(this).attr('value');
                Swal({
                  title: 'Emin misin?',
                  text: 'Bunu silmek istediğine emin misin?',
                  type: 'warning',
                  showCancelButton: true,
                  confirmButtonText: 'Evet!',
                  cancelButtonText: 'Hayır'
                }).then((result) => {
                  if (result.value) {
                    Swal(
                      'Silindi!',
                      'Silme işleminiz başarı ile gerçekleştirildi!',
                      'success'
                    )
                    setTimeout( function () { 
                        $(action).submit();
                    }, 600);
                  } else if (result.dismiss === Swal.DismissReason.cancel) {
                    Swal(
                      'İptal edildi',
                      'Silme işleminiz iptal edildi, içeriğiniz güvende!',
                      'error'
                    )
                  }
                })  
                return false;
            });
        });
    </script>
@endsection

@section('css')
    <link href="/backend/assets/custom/css/style.css" rel="stylesheet" type="text/css" />
@endsection

@endsection

Form.blade.php code screen.

@if(request()->route()->action['as']=='news.edit')
{!! Form::open(['url' => 'admin/news/'.$datas->id, 'method' => 'PATCH', 'enctype' => 'multipart/form-data', 'class'=>'m-form m-form--fit m-form--label-align-right']) !!}
@else
@php($meta_title = 'Lorem Ipsum is simply dummy text of the printing and typeset')
@php($meta_desc  = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries')
@php($datas = ['location'=> null,'en_title'=> null,'date'=> null, 'en_body'=> null, 'sort'=> null, 'category_id' => 0, 'created_at' => null, 'slug' => null, 'title' => null, 'body' => null, 'video' => null, 'status' => null, 'cover' => null, 'meta_title' => $meta_title, 'meta_image' => 'http://via.placeholder.com/600x315', 'meta_description' => $meta_desc])
{!! Form::open(['route' => 'news.store', 'enctype' => 'multipart/form-data', 'method' => 'POST', 'class'=>'m-form m-form--fit m-form--label-align-right']) !!}
@endif

<div class="m-portletx">
   <div class="m-portlet__body">
      <ul class="nav nav-pills nav-fill" role="tablist">
         <li class="nav-item">
            <a class="nav-link active" data-toggle="tab" href="#genel">
               Genel
            </a>
         </li>
         <li class="nav-item">
            <a class="nav-link" data-toggle="tab" href="#galeri">
               Galeri
            </a>
         </li>
         <li class="nav-item">
            <a class="nav-link" data-toggle="tab" href="#seo">
               SEO
            </a>
         </li>
      </ul>
      <div class="tab-content marginTop-40">
         <div class="tab-pane active" id="genel" role="tabpanel">
            
            <div class="form-group m-form__group row">
               <label class="col-xl-3 col-lg-3 col-form-label">
               Kategori :
               </label>
               <div class="col-xl-9 col-lg-9">
                  <select selectedvalue="{{ $datas['category_id'] }}" name="category_id" class="form-control m-input type" >
                     <option value="0">Seçiniz</option>
                     <option value="1">Haber</option>
                     <option value="2">Yayın</option>
                     <option value="3">Video</option>
                  </select>
                  <span class="m-form__help">
                  Ait olduğu kategoriyi seçin.
                  </span>
               </div>
            </div>
            {{
            Form::bsText(
            'title',
            'Başlık',
            'İçeriğinizin başlığı en az 3 ve en fazla 255 karakter olmalıdır.',
            $datas['title']
            )
            }}
            <div class="form-group m-form__group row">
               <label class="col-xl-3 col-lg-3 col-form-label">
                  Açıklama :
               </label>
               <div class="col-xl-9 col-lg-9">
                  <textarea name="body" class="form-control m-input summernote" >{{$datas['body']}}</textarea>
                  <span class="m-form__help">
                     İçeriğinizi bu alana yazın
                  </span>
               </div>
            </div>

            <div class="form-group m-form__group row">
               <label class="col-xl-3 col-lg-3 col-form-label">
                  Tarih : 
               </label>
               <div class="col-xl-9 col-lg-9">
                   <input style="width: 20%;" class="form-control m-input" type="date" name="created_at" 

                   
                  @if(request()->route()->action['as']=='news.edit')
                     value="{{$datas['created_at']->format('Y-m-d')}}"
                  @else
                     value="{{ date('Y-m-d') }}"
                   @endif

                    min="2018-01-01" >
                   <div class="clearfix"></div>
                  <span class="m-form__help">
                     İçerik bu alandan belirlediğiniz tarihe göre sıralanacaktır.
                  </span>
               </div>
            </div>
            {{
            Form::bsText(
            'video',
            'Video url',
            'Youtube Video kodu Ör. https://www.youtube.com/watch?v=Bl3KM79-fzo adresindeki v= den sonraki kod Bl3KM79-fzo',
            $datas['video']
            )
            }}


            <div class="form-group m-form__group row">
               <label class="col-form-label col-lg-3 col-sm-12">
                  Durumu :
               </label>
               <div class="col-lg-9 col-md-9 col-sm-12">
                  <input name="status" value="active" data-switch="true" type="checkbox" id="m_switch_1"
                  @if($datas['status']=='active' || $datas['status']=='') checked="checked" @endif
                  >
               </div>
            </div>
            <div class="clearfix"></div>
         </div>
         <div class="tab-pane" id="galeri" role="tabpanel">
            <div class="form-group m-form__group row">
               <div class="col-lg-12 col-md-12 col-sm-12">
                  <div class="m-dropzone dropzone m-dropzone--primary" id="m-dropzone-two">
                     
                     <div class="custom-file col-xl-9 col-lg-9">
                        <input name="img[]" multiple="" type="file" class="custom-file-input m-dropzone dropzone m-dropzone--primary" id="customFile">
                     </div>
                     <div class="clearfix"></div>
                     <div class="m-dropzone__msg dz-message needsclick">
                        <i class="la la-cloud-upload fontsize-40"></i>
                        <div class="clearfix"></div>
                        <h3 class="m-dropzone__msg-title">
                        Yüklemek istediğiniz resimleri buraya bırakın veya yüklemek için tıklayın.
                        </h3>
                        <span class="m-dropzone__msg-desc">
                           Boyutu en fazla 2mb olan 10 resim seçiniz, desteklenen resim formatları (jpg, png, gif, svg)dir.
                        </span>
                     </div>
                  </div>
               </div>
            </div>
            @if(request()->route()->action['as']=='news.edit')
            <ul class="editGal">
               @foreach($images as $image)
               <li>
                  <img src="{{ url('assets/images/uploads/news/'.$datas->id.'/thumbnails/'.$image->image) }}">
                  <div class="clearfix"></div>
                  <div class="delete">
                     <label class="m-checkbox">
                        <input name="deletePhoto[{{ $image->id }}]" type="checkbox">Sil
                        <span></span>
                     </label>
                  </div>
               </li>
               @endforeach
            </ul>
            <div class="clearfix"></div>
            @endif
         </div>
         <div class="tab-pane" id="seo" role="tabpanel">
            <div class="col-md-6 pull-left">
               {{
               Form::bsText(
               'slug',
               'Slug',
               'Bu alan benzersiz adresinizi ifade ediyor. Örn. siteniz.com/{slug}',
               $datas['slug'],
               $attribute = ['id' => 'meta-url']
               )
               }}
               {{
               Form::bsText(
               'meta_title',
               'Başlık',
               'Bu alan google aramalarda görünecek başlık kısmını ifade ediyor. (60 karakteri geçmemesi önerilir.)',
               $datas['meta_title'],
               $attribute = ['id' => 'meta-title']
               )
               }}
               {{
               Form::bsTextarea(
               'meta_description',
               'Açıklama',
               'Bu alan google aramalarda görünecek açıklama kısmını ifade ediyor. (320 karakteri geçmemesi önerilir.)',
               $datas['meta_description'],
               $attribute = ['id' => 'meta-desc']
               )
               }}
               {{
               Form::bsText(
               'meta_image',
               'Görsel',
               'Bu alan google aramalarda görünecek resim kısmını ifade ediyor. (600x315px ebatlarında bir görsel adresi girmelisiniz.)',
               $datas['meta_image'],
               $attribute = ['id' => 'meta-featured-image']
               )
               }}
            </div>
            <div class="col-md-6 pull-right">
               <h6>Google arama sonuçu görünümü</h6>
               <div id="seopreview-google"></div>
               <h6>Facebook paylaşım görünümü</h6>
               <div id="seopreview-facebook"></div>
            </div>
            <div class="clearfix"></div>
            
         </div>
         
      </div>
   </div>

   <div class="m-portlet__foot m-portlet__foot--fit">
      <div class="m-form__actions m-form__actions pull-right">
         <div class="row">
            <div class="col-lg-12 ml-lg-auto">
               <a href="{!! route('news.index') !!}" class="btn btn-secondary">Geri</a>

               {!! Form::submit('Kaydet', ['class'=>'btn btn-brand']) !!}
            </div>
         </div>
      </div>
   </div>
   <div class="clearfix"></div>
</div>
<div class="clearfix"></div>

{!! Form::close() !!}

<!--end::Form-->

edit.blade.php code screen.

@extends('backend.app')
@section('content')
    <div class="m-alert m-alert--icon m-alert--air m-alert--square alert alert-dismissible m--margin-bottom-30" role="alert">
        <div class="m-alert__icon">
            <i class="flaticon-exclamation m--font-brand"></i>
        </div>
        <div class="m-alert__text">
            Bu bölümden sitenizin haberlerini yönetebilirsiniz.
        </div>
    </div>
    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__head">
            <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                    Haberler
                    </h3>
                </div>
            </div>
        </div>
        @include('backend.news.form')
    </div>

@section('css')
    <link href="/backend/assets/custom/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/backend/assets/app/css/jquery-seopreview.css">
@endsection

@section('js')
    <script src="/backend/assets/demo/default/custom/header/actions.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/forms/widgets/bootstrap-switch.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/base/sweetalert2.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/forms/widgets/dropzone.js" type="text/javascript"></script>
    <script src="/backend/assets/app/js/jquery-seopreview.js"></script>
    <script type="text/javascript">
       $(document).ready(function() {
         $.seoPreview({
           google_div: "#seopreview-google",
           facebook_div: "#seopreview-facebook",
           metadata: {
             title: $('#meta-title'),
             desc: $('#meta-desc'),
             url: {
                use_slug: true,
                base_domain: '{{url('')}}/',
                full_url: $('#meta-url')
             }
           },
           google: {
               show: true,
               date: false
           },
           facebook: {
               show: true,
               featured_image: $('#meta-featured-image')
           }
         });
         $("select[selectedvalue]").each(function(){
            var self = $(this);
            self.val(self.attr("selectedvalue"));
        });
       });
     </script>

@if ($errors->any())
<script type="text/javascript">
    Swal({
      title: 'Hata!',
      text: '@foreach ($errors->all() as $error) {{ $error }} @endforeach',
      type: 'error',
      confirmButtonText: 'Tamam'
    })
</script>
@endif

@endsection

@endsection

create.blade.php code screen.

@extends('backend.app')
@section('content')
    <div class="m-alert m-alert--icon m-alert--air m-alert--square alert alert-dismissible m--margin-bottom-30" role="alert">
        <div class="m-alert__icon">
            <i class="flaticon-exclamation m--font-brand"></i>
        </div>
        <div class="m-alert__text">
            Bu bölümden sitenizin haberlerini yönetebilirsiniz.
        </div>
    </div>
    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__head">
            <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                    Haberler
                    </h3>
                </div>
            </div>
        </div>
        @include('backend.news.form')
    </div>
@section('css')
    <link href="/backend/assets/custom/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/backend/assets/app/css/jquery-seopreview.css">
@endsection


@section('js')
    <script src="/backend/assets/demo/default/custom/header/actions.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/forms/widgets/bootstrap-switch.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/base/sweetalert2.js" type="text/javascript"></script>
    <script src="/backend/assets/demo/default/custom/components/forms/widgets/dropzone.js" type="text/javascript"></script>
    <script src="/backend/assets/app/js/jquery-seopreview.js"></script>
    <script type="text/javascript">
       $(document).ready(function() {
        $( "#meta-title" ).click(function() {
          $( "#meta-title" ).val('');
        });
        $( "#meta-desc" ).click(function() {
          $( "#meta-desc" ).val('');
        });
        $( "#meta-featured-image" ).click(function() {
          $( "#meta-featured-image" ).val('');
        });
         $.seoPreview({
           google_div: "#seopreview-google",
           facebook_div: "#seopreview-facebook",
           metadata: {
             title: $('#meta-title'),
             desc: $('#meta-desc'),
             url: {
                use_slug: true,
                base_domain: '{{url('')}}/',
               full_url: $('#meta-url')
             }

           },
           google: {
               show: true,
               date: false
           },
           facebook: {
               show: true,
               featured_image: $('#meta-featured-image')
           }
         });
       });
     </script>
@if ($errors->any())
<script type="text/javascript">
    Swal({
      title: 'Hata!',
      text: '@foreach ($errors->all() as $error) {{ $error }} @endforeach',
      type: 'error',
      confirmButtonText: 'Tamam'
    })
</script>
@endif


@endsection

@endsection

Unable to search data in a mongodb database using laravel

I am trying to write a query to search the mongodb database for a specific query and return the associated information here is what I have done so far:
In Post:

<?php 
namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use JenssegersMongodbEloquentModel;
class Post extends Model
{

use HasFactory;
protected $connection = 'mongodb';
protected $collection = 'post';
protected $fillable = [
'STATUS',
'DDC_CODE',

'TRADE_NAME',

'SCIENTIFIC_CODE',

'SCIENTIFIC_NAME',

'INGREDIENT_STRENGTH',

'DOSAGE_FORM_PACKAGE',

'ROUTE_OF_ADMIN',
'PACKAGE_PRICE',

'GRANULAR_UNIT',

'MANUFACTURER',

'REGISTERED_OWNER',

'UPDATED_DATE',

'SOURCE'
];}

In PostController:

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;
use AppModelsPost;

class PostController extends Controller
{

public function home() {
    $posts = Post::paginate(4);

    return view('home', compact('posts'));
}
public function search(Request $request){
    
    if(isset($_GET['query'])){
        $search_text=$_GET['query'];
        $searchs=Post::whereRaw(array('$text'=>array('$search'=> $search_text)))->get();;
        return view('search',['searchs'=>$searchs]);
    }
    else{
        return view('search');
    }
 }
}

And the search.blade.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Laravel search</title>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-6" style="margin-top:40px">
            <h4>Search Everything</h4><hr>
            <form action="{{ route('web.search')}}" method="GET">
                <div class="form-group">
                    <label for="">Enter keyword</label>
                    <input type="text" class="form-control" name="query" placeholder="Search here...">
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary">Search</button>
                </div>
            </form>
            <br>
            <br>
            <hr>
            <br>
            <table border = "1">
            <tr>
            <td>STATUS</td>
            <td>DDC_CODE</td>
            <td>TRADE_NAME</td>
            <td>SCIENTIFIC_CODE</td>
            <td>SCIENTIFIC_NAME</td>
            <td>SCIENTIFIC_CODE</td>
            <td>INGREDIENT_STRENGTH</td>
            <td>DOSAGE_FORM_PACKAGE</td>
            <td>ROUTE_OF_ADMIN</td>
            <td>PACKAGE_PRICE</td>
            <td>GRANULAR_UNIT</td>
            <td>MANUFACTURER</td>
            <td>UPDATED_DATE</td>
            <td>SOURCE</td>
            </tr>
            @foreach ($searchs as $search)
            <tr>

            <td>{{ $search['STATUS'] }}</td>
            <td>{{ $search['DDC_CODE'] }}</td>
            <td>{{ $search['TRADE_NAME'] }}</td>
            <td>{{ $search['SCIENTIFIC_CODE'] }}</td>
            <td>{{ $search['SCIENTIFIC_NAME'] }}</td>
            <td>{{ $search['INGREDIENT_STRENGTH'] }}</td>
            <td>{{ $search['DOSAGE_FORM_PACKAGE'] }}</td>
            <td>{{ $search['ROUTE_OF_ADMIN'] }}</td>
            <td>{{ $search['PACKAGE_PRICE'] }}</td>
            <td>{{ $search['GRANULAR_UNIT'] }}</td>
            <td>{{ $search['MANUFACTURER'] }}</td>
            <td>{{ $search['REGISTERED_OWNER'] }}</td>
            <td>{{ $search['UPDATED_DATE'] }}</td>
            <td>{{ $search['SOURCE'] }}</td>
            </tr>
            @endforeach
            </table>
</body>
</html>

Also the route handler web.php:

<?php

use IlluminateSupportFacadesRoute;
use AppHttpControllersPostController;

Route::get('/', function () {
     return view('welcome');
});
Route::get('view','AppHttpControllersPostController@home');
Route::get('/search',[PostController::class,'search'])- 
>name('web.search');

When I run the code for some reason it gives me a ErrorException Undefined variable: searchs in the search.blade.php and marks the first line of the loop. Also there is no problems with the connection itself as the home method in the postController runs flawlessly. I believe there is one of two possibilities the query in my post controller is wrong and is therefore causing the error or something is wrong in the blade file not sure which. Any and all help is appreciated.

How validate an array? (Laravel)

How can I validate this array in laravel validation:

"price" => array:1 [▼
           0 => array:1 [▼
                "price.value" => 50
]

I tried to use this, but it does’t working:

'price.0.price.value' => ['required']

How can I solve?
I want to note that: I have no choice to change the name “price.value”.

Redirect with data back to where the form was completed laravel

I have a form from which the controller gets the data requested from the db. I want to then redirect to the same page as the form but with the data i got from the db. I am using laravel 5.5

This is my controller for the store:

    public function listsStore(Request $request) {
        $data = $request->all();
        $user = $request->user;
        $day = date('Y-m-d', strtotime($request->day));
        $from =  date('Y-m-d', strtotime($request->from));
        $to = date('Y-m-d', strtotime($request->to));
        $radio = $data['radio-btn'];

        // dd($user, $from, $to);
        // dd($radio);

        if($radio === 'tasks') {
            if($request->day) {
                $tasks = Task::where('user_id', $user)
                        ->whereDate('start', $day)
                        ->orderBy('start','DESC')
                        ->get();
                // dd($tasks);
                return redirect()->back()->with('tasks', $tasks);
            }else{ // gets for the range of dates requested
                $tasks = Task::where('user_id', $user)
                        ->whereBetween('start',[$from, $to])
                        ->orderBy('start','DESC')
                        ->get()
                        ->groupBy(function($date) {
                        return Carbon::parse($date->start)->format('Y-m-d'); 
                        });
                // dd($tasks);
                return redirect()->back()->with('tasks', $tasks);
            } 
        }elseif($radio === 'timecards'){ //IF REQUEST IS TIMECARDS
            if($request->day) { //gets for the day requested
                $timecards = Timecard::where('user_id',$user)
                            ->whereDate('checkin', $day)
                            ->orderBy('checkin','DESC')
                            ->get();
                // dd($timecards);
                return redirect()->back()->with('timecards', $timecards);
            } else{ // gets for the range of dates requested
                $timecards = Timecard::where('user_id', $user)
                            ->whereBetween('checkin',[$from, $to])
                            ->orderBy('checkin','DESC')
                            ->get()
                            ->groupBy(function($date) {
                                return Carbon::parse($date->checkin)->format('Y-m-d'); 
                            });
                // dd($timecards);
                return redirect()->back()->with('timecards', $timecards);
            }
        }
        // return redirect('backend.list');
    }

controller for the page:

    public function lists() {
        $users = User::all();
        return view( 'backend.list', compact('users'));
    }

and in the view i tried this way:

    @if(session()->has('timecards'))
        @foreach($timecards as $timecard)
            <div>{{$timecard->checkin}}</div>
        @endforeach
    @endif

Thank you

What’s wrong with my MYSQL Code query in php file?

I have two tables in mysql database

one table named is place:

place_id place active shortform country type
1 Uttar Pradesh 1 UP India State
2 Delhi 1 DELHI India Union territory
3 Punjab 1 PUN India State
4 Karnataka 1 KAR India State
5 Kerala 1 KER India State
6 Lucknow 1 LKO India Capital
7 Chandigarh 1 CHA India Capital
8 Bengaluru 1 BEN India Capital
9 Thiruvanthapuram 1 THI India Capital
10 Saharanpur 1 SAH India District
11 Meerut 1 MEE India District
12 Gorakhpur 1 GOR India District

and other named as place_capital

id_place_place place_parent place_child
1 1 6
2 3 7
3 4 8
4 5 9
5 1 10
6 1 11
7 1 12

I run this query

select *, group_concat(place_capital.place_child) AS Group from place
left join place_capital on place.place_id = place_place.place_parent
where place.place_id = place_place.place_parent and active = :active AND type = :type
group by place ORDER BY place

and it give the following result

place_id place active shortform country type id_place_place place_parent place_child Group
1 Uttar Pradesh 1 UP India State 1 1 6 6,10,11,12
3 Punjab 1 PUN India State 2 3 7 NULL
4 Karnataka 1 KAR India State 3 4 8 NULL
5 Kerala 1 KER India State 4 5 9 NULL

What query I used in php file to give the following result that include Delhi also.
The place table have some relationship with place_place table. with my above sql query that not give the Delhi in the result. So, what is the thing I missed in the php file to get the below result.

place_id place active shortform country type id_place_place place_parent place_child Group
1 Uttar Pradesh 1 UP India State 1 1 6 6,10,11,12
2 Delhi 1 DELHI India Union Territory NULL NULL NULL NULL
3 Punjab 1 PUN India State 2 3 7 NULL
4 Karnataka 1 KAR India State 3 4 8 NULL
5 Kerala 1 KER India State 4 5 9 NULL

and here is the code in the php file:-

public function __construct(Querier $db, $type = "", $active = 1) {
$this->db = $db;
$this->type = $type;
$this->active = $active;

$connection = $this->db->getConnection();

if ($this->type != "") {
    $statement = $connection->prepare("select *, group_concat(place_capital.place_child) AS Group from place
                                    left join place_capital on place.place_id = place_place.place_parent
                                    where place.place_id = place_place.place_parent and active = :active AND type = :type
                                    group by place ORDER BY place ");
    $statement->bindParam(":type", $this->type);
} else {
    $statement = $connection->prepare("SELECT * FROM place WHERE active = :active ORDER BY place ");
}

$statement->bindParam(":active", $this->active);
$statement->execute();
$this->_guide_list = $statement->fetchAll();

}

How to deploy Django Based Server and Laravel Project Simultaneously on a Single Droplet

I am new to Digital Ocean and was wondering on how to deploy Django and Laravel code side-by-side. The code works fine locally but I don’t know how to deploy the both sources over Digital Ocean droplet.

We bought cloudways server but it doesn’t offer anything other than PHP which was the limitation. So, we don’t have any experience with deployment on Digital Ocean.

Is there anyone who can help me with this?


Thank you!

PDO MySQL external connection stale after being inactive for specific amount of seconds

Software versions:

PHP 8.1.5 (cli)
mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))

After migrating our database to the new server and new software I noticed strange behaviour which could be shown with this simplified code snippet below:

<?php
    $host = '<remote host (external IP)>';
    $db   = '<db name>';
    $user = '<user>';
    $pass = '<password>';
    $charset = 'utf8mb4';

    $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
    $options = [
        PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES   => false,
        PDO::ATTR_TIMEOUT            => 5
    ];
    try {
        //executing first statement, no problem
        echo 'CREATING PDO OBJECT'.PHP_EOL;
        $pdo = new PDO($dsn, $user, $pass, $options);

        echo 'PDO OBJECT CREATED, PREPARING STATEMENT'.PHP_EOL;
        $stmt = $pdo->prepare('SELECT *
                FROM someObject
                WHERE objectID = 1');
        echo 'STATEMENT PREPARED, EXECUTING STATEMENT'.PHP_EOL;
        $stmt->execute();
        echo 'STATEMENT EXECUTED, FETCHING RESULT: ';
        $result = $stmt->fetch();
        echo count($result).PHP_EOL;

        $sleep = 258;
        echo 'SLEEP: '.$sleep.PHP_EOL;
        sleep($sleep);
        echo 'WOKE UP'.PHP_EOL;

        //executing second statement after sleep, hangs
        echo 'PREPARING STATEMENT'.PHP_EOL;
        $stmt = $pdo->prepare('SELECT *
                FROM someObject
                WHERE objectID = 2');
        echo 'STATEMENT PREPARED, EXECUTING STATEMENT'.PHP_EOL;
        $stmt->execute(); //hangs here
        echo 'STATEMENT EXECUTED, FETCHING RESULT: ';
        $result = $stmt->fetch();
        echo count($result).PHP_EOL;

    } catch (PDOException $e) {
         throw new PDOException($e->getMessage(), (int)$e->getCode());
    }

This script output is:

CREATING PDO OBJECT
PDO OBJECT CREATED, PREPARING STATEMENT
STATEMENT PREPARED, EXECUTING STATEMENT
STATEMENT EXECUTED, FETCHING RESULT: 20
SLEEP: 258
WOKE UP
PREPARING STATEMENT

After this process becomes stale and does nothing, WOKE UP is the last sentence I see in the output until max execution time is reached – then the process is dropped by PHP. It happens always if logic reaches 258 seconds of database inactivity.

If I reduce sleep time to 257 seconds – it always works, I see a second result, and the script finishes successfully. For me, it looks like there is some parameter that blocks connection after 257 seconds of inactivity.
On the MySQL side, I see following

SHOW FULL PROCESSLIST;
+------+-----------------+---------------------+------------------+
| Id   | User   | Host   | db   | Command  | Time | State | Info |
+------+-----------------+---------------------+------------------+
| <id> | <user> | <host> | <db> | Sleep    | 1258 |       | NULL |
+------+-----------------+---------------------+------------------+

As you may see – Time is 1258 here, it never gets closed (only after it reaches MySQL wait_timeout).
MySQL timeouts below

+-----------------------------------+----------+
| Variable_name                     | Value    |
+-----------------------------------+----------+
| connect_timeout                   | 10       |
| delayed_insert_timeout            | 300      |
| have_statement_timeout            | YES      |
| innodb_flush_log_at_timeout       | 1        |
| innodb_lock_wait_timeout          | 50       |
| innodb_rollback_on_timeout        | OFF      |
| interactive_timeout               | 28800    |
| lock_wait_timeout                 | 31536000 |
| mysqlx_connect_timeout            | 30       |
| mysqlx_idle_worker_thread_timeout | 60       |
| mysqlx_interactive_timeout        | 28800    |
| mysqlx_port_open_timeout          | 0        |
| mysqlx_read_timeout               | 30       |
| mysqlx_wait_timeout               | 28800    |
| mysqlx_write_timeout              | 60       |
| net_read_timeout                  | 30       |
| net_write_timeout                 | 60       |
| replica_net_timeout               | 60       |
| rpl_stop_replica_timeout          | 31536000 |
| rpl_stop_slave_timeout            | 31536000 |
| slave_net_timeout                 | 60       |
| ssl_session_cache_timeout         | 300      |
| wait_timeout                      | 28800    |
+-----------------------------------+----------+
23 rows in set (0.00 sec)

You may say that the DB connection shouldn’t be kept open if not needed and I agree with that, it is what I did to fix this problem. However, on the previous server, I noticed nothing like that and wondering what’s happening here.
Please, don’t suggest using the persistent connection, I want to find the reason, not fix consequences.

Shopware 6 change shipping method programmatically in checkout on order submission

I have two of same shipping methods with different price matrix, depending on customer distance, one of the two shipping method should be selected. This has to be done programmatically on checkout order confirmation, I looked at the cart collector, but it’s about changing price of an item. I didn’t find anything covered in documentation regarding shipping method change.

private function getShippingMethod(string $id, Context $context): ?ShippingMethodEntity
{
    $criteria = new Criteria();
    $criteria->addFilter(new EqualsFilter("id", $id));
    $criteria->setLimit(1);
    $result = $this->shippingMethodRepository->search($criteria, $context);
    return $result->getEntities()->first();
}

public function onOrderValidation(BuildValidationEvent $event)
    {

        ....
   
        $cart = $this->cartService->getCart($this->salesChannelContext->getToken(), $this->salesChannelContext);

        $delivery = $cart->getDeliveries()->first();

        $shippingMethod = $this->getShippingMethod($this->getShippingMethodZoneXId(), $event->getContext());
        $delivery->setshippingMethod($shippingMethod);

}

In the above code I have cart object, and delivery. I get the shipping method which I need to set, but it doesn’t get updated.

Also i need to recalculate shipping price, what is the correct way to do it. any suggestion will be appreciated.

Re-index a php array on key

I have an array created in PHP which is used downstream in a Garmin connectIQ app. I have created a script which generates the below Var_export

  array (
  '2022-05-14' => 
  array (
    0 => 
    array (
      'index' => 0,
      'time' => '05:18:31',
      'timeE' => 1652501911,
      'type' => 'High',
      'height' => '7.9m',
      'diff' => '1day 15hrs',
    ),
    1 => 
    array (
      'index' => 1,
      'time' => '11:39:16',
      'timeE' => 1652524756,
      'type' => 'Low',
      'height' => '1.3m',
      'diff' => '1day 8hrs',
    ),
    2 => 
    array (
      'index' => 2,
      'time' => '17:43:49',
      'timeE' => 1652546629,
      'type' => 'High',
      'height' => '8m',
      'diff' => '1day 2hrs',
    ),
    3 => 
    array (
      'index' => 3,
      'time' => '23:57:31',
      'timeE' => 1652569051,
      'type' => 'Low',
      'height' => '1.2m',
      'diff' => '20hrs 27mins',
    ),
  ),
  '2022-05-15' => 
  array (
    4 => 
    array (
      'index' => 4,
      'time' => '06:02:02',
      'timeE' => 1652590922,
      'type' => 'High',
      'height' => '8.3m',
      'diff' => '14hrs 22mins',
    ),
    5 => 
    array (
      'index' => 5,
      'time' => '12:22:53',
      'timeE' => 1652613773,
      'type' => 'Low',
      'height' => '1m',
      'diff' => '8hrs 2mins',
    ),
    6 => 
    array (
      'index' => 6,
      'time' => '18:26:19',
      'timeE' => 1652635579,
      'type' => 'High',
      'height' => '8.4m',
      'diff' => '1hr 58mins',
    ),
  ),
)

However, what I need, is the output to be re-indexed on each date change

array (
      '2022-05-14' => 
      array (
        0 => 
        array (
          'index' => 0,
          'time' => '05:18:31',
          'timeE' => 1652501911,
          'type' => 'High',
          'height' => '7.9m',
          'diff' => '1day 15hrs',
        ),
        1 => 
        array (
          'index' => 1,
          'time' => '11:39:16',
          'timeE' => 1652524756,
          'type' => 'Low',
          'height' => '1.3m',
          'diff' => '1day 8hrs',
        ),
        2 => 
        array (
          'index' => 2,
          'time' => '17:43:49',
          'timeE' => 1652546629,
          'type' => 'High',
          'height' => '8m',
          'diff' => '1day 2hrs',
        ),
        3 => 
        array (
          'index' => 3,
          'time' => '23:57:31',
          'timeE' => 1652569051,
          'type' => 'Low',
          'height' => '1.2m',
          'diff' => '20hrs 27mins',
        ),
      ),
      '2022-05-15' => 
      array (
        0 => 
        array (
          'index' => 4,
          'time' => '06:02:02',
          'timeE' => 1652590922,
          'type' => 'High',
          'height' => '8.3m',
          'diff' => '14hrs 22mins',
        ),
        1 => 
        array (
          'index' => 5,
          'time' => '12:22:53',
          'timeE' => 1652613773,
          'type' => 'Low',
          'height' => '1m',
          'diff' => '8hrs 2mins',
        ),
        2 => 
        array (
          'index' => 6,
          'time' => '18:26:19',
          'timeE' => 1652635579,
          'type' => 'High',
          'height' => '8.4m',
          'diff' => '1hr 58mins',
        ),
      ),
    )

I have been unable to figure this one out and my searches are coming up short. Appreciate any guidance offered

Bonjour à tous, je suis entrain de faire un bouton supprimer pour supprimer les articles publiés [closed]

J’ai l’erreur suivante :Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘>id ?’ at line 1 in C:xampphtdocssiteEnvoladminsupprimerArticle.php:6 Stack trace: #0 C:xampphtdocssiteEnvoladminsupprimerArticle.php(6): PDO->query(‘SELECT * FROM p…’) #1 {main} thrown in C:xampphtdocssiteEnvoladminsupprimerArticle.php on line 6

Voici le code de ma page de suppresion
`<?php

require_once'connect.php';

    if (isset($_GET['id'])) {
        $req = $bdd->query('SELECT * FROM publication WHERE id = '.$_GET['id']);
        $article = $req->fetch();
        if ($article) {
            $req = $bdd->query('DELETE  FROM publication WHERE id = '.$_GET['id']);
            header('location:index.php');
        } else {
            header('location:index.php');
        }
        
    } 

?>`

Remove multiple occurences of unknown text between tags

I want to use mySQL, or PHP (if too tough in SQL), to get rid of all occurrences of any text between certain strings/tags.
I have a database field that looks like the following:

<chrd>F Gm<br><indx>Here's a little song I wrote You might want to sing it note for note...<br><chrd> Bb C F<br><text>Don't Worry Be Happy<br><text>In every life we have some trouble When you worry you make it double...<br><text>Don't Worry Be Happy

I want to remove the text between the tags <chrd> and <br> (tags included or not). I have tried SELECT substring_index(substring_index(text, '<chrd>', -1), '<br>', 1),'') FROM songs; but returns only the last occurrence ( Bb C F). How can I select all occurrences?
Also, the above returns all the text if there is a song with no chords. I would like it to return empty string.

After I get rid of the chords, I will do multiple REPLACE to remove all the tags, so that I will be left with only the plain text, the lyrics. (This OK, I can do)

Note: I don’t know about regular expressions and procedures

Problems to download excel-list Laravel 9

We have the opportunity to download results as an excel-file like this: https://imgur.com/w1g3tnB But this doesn’t work here in Laravel 9.
This is how it looks in pdf: https://imgur.com/usjgBgw
I have replaced the create() to download() but hen I got the error

MaatwebsiteExcelExcel::download(): Argument #2 ($fileName) must be of type string, Closure given

in MaatwebsiteExcelRepository:

<?php

namespace AppRepositories;

use AppContractsExcelInterface;
use Excel;

class MaatwebsiteExcelRepository implements ExcelInterface
{
    /**
     * Creates a file based on given data.
     *
     * @param  string $filename
     * @param  array $rows
     * @param  array $args
     * @return object
     */
    public function create($filename, $rows, $args = [])
    {
        $args['title'] = $this->getTitle($args);
        $args['creator'] = $this->getCreator($args);
        $args['company'] = $this->getCompany($args);
        $args['description'] = $this->getDescription($args);
        $args['keywords'] = $this->getKeywords($args);

        $filenameParts = pathinfo($filename);
        $filename = $filenameParts['filename'];

**COMMENT Next line gives the error**
        return Excel::download($filename, function ($excel) use ($rows, $args) {
            $excel->setTitle($args['title']);
            $excel->setCreator($args['creator']);
            $excel->setCompany($args['company']);
            $excel->setDescription($args['description']);
            $excel->setKeywords($args['keywords']);

            if (count($rows) === 0) {
                $rows[0] = [];
            }

            $excel->sheet('sheet1', function ($sheet) use ($rows) {

                // Make the header row bold.
                $sheet->cells('1:1', function ($cells) {
                    $cells->setFontWeight('bold');
                });

                if (! empty($rows[0])) {

                    // Make sure all columns in the rows are strings.
                    foreach ($rows as $rowIndex => $row) {
                        if (! empty($row) && is_array($row)) {
                            $rows[$rowIndex] = array_map('strval', $row);
                        } else {
                            $rows[$rowIndex] = $row;
                        }
                    }
                }

                $sheet->fromArray($rows);
            });

            // Create an empty second sheet, which is the default for most excel files.
            $excel->sheet('sheet2', function ($sheet) use ($rows) {
            });
        });
    }

So this:

return Excel::download($filename, function ($excel) use ($rows, $args)

must be rearranged in a way.
But how?
As before this works in Laravel 5.3

Eloquent formatting data with __get

I’m quite new to PHP / Eloquent in general and I’m trying to make a little data formatter in my Model class.

public function __get($key)
{
    switch ($key) {
        case "preferred":
            $this->attributes[$key . "_formatted"] = ($this->getAttribute($key) == 1) ? "Yes" : "No";
            break;
    }

    return parent::__get($key);
}

which works fine, it formats the data I want it to format. Thought when I want to $model->update() I get the error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'preferred_formatted' in 'field list' 

Is there a way so I can make it so when I update my $model it doesn’t look for preferred_formatted.
I’ve tried making it hidden but to no avail, I’ve also tried some different solutions but at this point I’m not sure if there’s a better way to format data or if I’m doing something wrong, any help is appreciated.