jeudi 15 avril 2021

A non-numeric value encountered while submitting a login form laravel 5.5

Please i created a login form for my forum website but i got this error while trying to submit ** (View: /Applications/XAMPP/xamppfiles/htdocs/laravel-forum-master-3/resources/views/auth/login.blade.php)** and also if i didn't check the remember me botton it will give me a reply of invalid credentials

below is my code in login.blade.php

<form action="" method="post" id="login">
    
    @if(!empty(app('request')->input('redirectTo')))
    <input type="hidden" name="redirectTo" value="" />
    @endif
    <div class="panel">
        <div class="inner">
            <div class="content">
                <h2 class="login-title">Login</h2>
                <fieldset class="fields1">
                    <dl>
                        <dt><label for="email">Email address:</label></dt>
                        <dd>
                            <input type="text" name="email" id="email" size="25" value="" class="inputbox autowidth" />
                            @if ($errors->has('email'))
                            <br /><span class="error"></span>
                            @endif
                        </dd>
                    </dl>
                    <dl>
                        <dt><label for="password">Password:</label></dt>
                        <dd>
                            <input type="password" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off" />
                            @if ($errors->has('password'))
                            <br /><span class="error"></span>
                            @endif
                        </dd>
                        <dd><a href="">I forgot my password</a></dd>
                    </dl>
                    <dl>
                        <dd><label for="autologin"><input type="checkbox" name="remember" id="autologin"   /> Remember me</label></dd>
                    </dl>
                    <dl>
                        <dt>&nbsp;</dt>
                        <dd><input type="submit" name="login" value="Login" class="button1" /></dd>
                    </dl>
                </fieldset>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="inner">
            <div class="content">
                <h3>Register</h3>
                <p>In order to login you must be registered. Registering takes only a few moments but gives you increased capabilities.</p>
                <hr class="dashed" />
                <p><a href="" class="button2">Register</a></p>
            </div>
        </div>
    </div>
</form>


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

Is there any php function to find any url title or description?

I am new in data scraping, i am working on url to title scraping, actually i want to write a funtion that take a url/link as request and in return i get <title> </title> , og:title , og:description etc. all meta property

i am trying this funtion for scrape only title

/**
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     *
     * @throws ValidationException
     */
    public function getTitle(Request $request)
    {
        $this->validate($request, [
            'link' => 'required',
        ]);

        $link = $request->input('link');

        $str = @file_get_contents($link);
        if(strlen($str)>0){
            $str = trim(preg_replace('/\s+/', ' ', $str));
            preg_match("/\<title\>(.*)\<\/title\>/i",$str,$title);
            $result = $title[1];
        }

        return Response::json([
            'message' => 'Get title',
            'data'    => $result,
        ], \Symfony\Component\HttpFoundation\Response::HTTP_OK);
    }

route

Route::post('request-title', 'BuyShipRequestController@getTitle');

Example what i request in input field:

Amazon-url

and what i want to my reutrn response

<title>Amazon.com: Seagate Portable 2TB External Hard Drive Portable HDD – USB 3.0 for PC, Mac, PS4, &amp; Xbox - 1-Year Rescue Service (STGX2000400): Computers &amp; Accessories</title>

and

<meta name="description"/> , <meta name="title"/>, <meta name="keywords" /> , link 

in return response i want only those meta properties content or value



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

Eloquent Model Join Table and Sub Query

I have few questions about the Laravel Eloquent Model. Assume that I have few tables at the bottom OrderDetail od_id p_id unitprice qty

Product p_id name price pc_id

Product Category pc_id category

Expected output query

SELECT P.name,IFNULL(0.00,(SELECT SUM(OD.unitprice*OD.qty) FROM OrderDetail AS OD WHERE O.p_id = P.pid GROUP BY OD.p_id))
FROM products AS P INNER JOIN ProductCategory AS PC ON
p.pc_id = PC.pc_id WHERE PC.category = 'Snack';

Attempts: Model Product Model

public function order(){
    return $this->belongsTo(OrderDetail::class);
}

public function category(){
  return $this->belongsTo(ProductCategory::class);
}

OrderDetail Model

public function product(){
   return $this->hasMany(Product::class);
}

ProductCategory Model

public function product(){
   return $this->hasMany(Product::class);
}

Pull Data Controller

Product::with("category")->where("ProductCategory.category","Snack")->get();

But I am stucking to attach the sub query inside to the select column...

Thanks.



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

Datatable Custom Toolbar Not Working With Select2 CSS

This is the code

<link href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
 <!-- problem lays here -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />

<script type="text/javascript">

$(function () {
 
  $.ajaxSetup({
      headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
      }
});

var table = $('.data-table').DataTable({
    processing: true,
    serverSide: true,
    responsive: true,
    ajax: "",
    dom: '<l<"toolbar">f>rtip',
    initComplete: function(){
      $("div.toolbar").html('<div style="float:left;margin-left:4px;"><select class="form-control select2bs4 select2-hidden-accessible trash_all" style="width:140px;height:32px;margin-left:10px;" data-select2-id="17" tabindex="-1" aria-hidden="true"><option selected="selected" data-select2-id="19">Bulk Actions</option><option data-select2-id="38" value="trashAll">Trash</option></select></div><div style="float:left;margin-left:20px;"><select onchange="window.location = this.options[this.selectedIndex].value" class="form-control select2bs4 select2-hidden-accessible download-doc" style="width:140px;height:32px;margin-left:10px;padding-bottom:5px"" data-select2-id="17" tabindex="-1" aria-hidden="true"><option selected="selected" data-select2-id="19" value="">Download</option><option data-select2-id="38" value="">PDF</option><option data-select2-id="39" value="">XLS</option><option data-select2-id="39" value="">Doc</option></select></div>');
    },
    columns: [
        {data: 'DT_RowIndex', name: 'DT_RowIndex'},
        {data: 'name', name: 'name'},
        {data: 'email', name: 'email'},
        {data: 'roles', name: 'roles'},
        {data: 'status', name: 'status'},
        {data: 'action', name: 'action', orderable: false, searchable: false},
    ]
});

$("div.toolbar").css("float", "left");

$('#roles').select2({
  ajax: {
  url: '',
  processResults: function(data){
  return {
    results: data.map(function(item){return {id: item.id, text: item.name} })
  }
 }
}
});

When I remove this code

<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />

Custom toolbar is working enter image description here

But, when I let the code above exist, custom toolbar element is gone. I should make it exist because select2 not working if I remove code above.



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

background image in laravel jetstream login page

in this page I want to use background image in laravel-8jetstream. on which template I use to insert background image

enter image description hereimgur.com/heZvk.jpg



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

API CALL ERROR curl_setopt_array(): Cannot represent a stream of type Output as a STDIO FILE*

I keep getting this error when I try to make an API call on my laravel App. v8

$uploadedImage = $request->image->store('watermark');
$photo = fopen($uploadedImage, 'r');

$response = Http::withHeaders([
        'content-type' => 'multipart/form-data',
    ])->withOptions([
        'debug' => true,
    ])->attach(
        'image', $photo, $uploadedImage
    )->post('http://dummyapiwebsite.com/');

dd($response)



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

How to Unauthorized user can not access Image URL from Laravel

I Have a laravel project with API. Now I want to integrate image protection like if users login then that user image url can access otherwise not.

If Any Users can copy URL and past in image url in the browser then if users have login with My web then see my images otherwise user can not see my images.

I have flow below reference URL and tried to implement and I have to get a blob URL and that accessible in the google viewer but this three extension png, jpeg, and PDF but the other extension for Word files like doc, Docx, dot, and dots, etc can not work. getting error and preview that.

https://stackoverflow.com/questions/30682421/how-to-protect-image-from-public-view-in-laravel-5#:~:text=Create%20Route,person%20is%20not%20logged%20in

Anyone have any idea about laravel, PHP then please guide us.

Thanks!



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