Imamul.Hossain

Experience

700

0 Best Reply Awards

  • Member Since 6 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

30th August, 2017

Imamul.Hossain left a reply on ErrorException-Trying To Get Property Of Non-object • 1 month ago

@Snapey and @larel_b

I'll see it, thank you so much

29th August, 2017

Imamul.Hossain left a reply on ErrorException-Trying To Get Property Of Non-object • 1 month ago

@Snapey

I tried the following code, but found same error

<?php
$latestProduct = App\Product::where('categoryId', $publishedCategory->id)
                           ->where('publicationStatus', 1)
                           ->get();
if ($latestProduct!=NULL){
       $lastProduct = collect($latestProduct)->last();
       $productImage = explode('|', $lastProduct->productImage);
?>
<img src="{{asset($productImage[0])}}" alt="{{$lastProduct->productName}}" style="height: 200px"/>
<?php } ?>

Imamul.Hossain left a reply on ErrorException-Trying To Get Property Of Non-object • 1 month ago

Thank You @Snapey and @Cronix

Tried several times, but found same errors. Actually I want the first image of last product of the corresponding categories. More than 1 image are imploded as

public/uploadedFile/product/Sharee1_C2_M2_1503688530.jpg|public/uploadedFile/product/Sharee2_C2_M2_1503688530.jpg|public/uploadedFile/product/Sharee3_C2_M2_1503688530.jpg|public/uploadedFile/product/Sharee4_C2_M2_1503688530.jpg

Now I want the first image (public/uploadedFile/product/Sharee1_C2_M2_1503688530.jpg) from the array which is from explode(). What can I do now?

28th August, 2017

Imamul.Hossain left a reply on ErrorException-Trying To Get Property Of Non-object • 1 month ago

@Snapey May I check NULL using 'if' condition?

Imamul.Hossain started a new conversation ErrorException-Trying To Get Property Of Non-object • 1 month ago

Trying to get property of non-object (View: C:\wamp64\www\smartKenaKata\resources\views\frontEnd\home\homePages\menu.blade.php) (View: C:\wamp64\www\smartKenaKata\resources\views\frontEnd\home\homePages\menu.blade.php) (View: C:\wamp64\www\smartKenaKata\resources\views\frontEnd\home\homePages\menu.blade.php)

<div class="ban-top">
    <div class="container">
        <div class="top_nav_left">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                                data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                    </div>
                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse menu--shylock" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav menu__list">
                            <li class="active menu__item menu__item--current"><a class="menu__link" href="{{url('/')}}">Home
                                    <span class="sr-only">(current)</span></a></li>
                            <?php
                            $publishedCategories = App\Category::where('parentCategoryId', NULL)
                                ->where('publicationStatus', 1)
                                ->get();
                            ?>>
                            @foreach($publishedCategories as $publishedCategory)
                                {{$publishedCategory->id}}
                                <li class="dropdown menu__item">
                                    <a href="#" class="dropdown-toggle menu__link" data-toggle="dropdown" role="button"
                                       aria-haspopup="true" aria-expanded="false">{{$publishedCategory->categoryName}}
                                        <span class="caret"></span></a>
                                    <ul class="dropdown-menu multi-column columns-3">
                                        <div class="row">
                                            <div class="col-sm-6 multi-gd-img1 multi-gd-text ">
                                                <a href="{{url('/products-by-category/catId='.$publishedCategory->id)}}">
                                                    <?php
                                                    $latestProduct = App\Product::where('categoryId',$publishedCategory->id)
                                                        ->orderBy('id', 'desc')
                                                        ->get();
                                                    $lastProduct = collect($latestProduct->where('publicationStatus', 1))->last();
                                                    $productImage = explode('|', $lastProduct->productImage);
                                                    ?>
                                                    <img src="{{asset($productImage[0])}}"
                                                         alt="{{$lastProduct->productName}}" style="height: 200px"/>
                                                </a>
                                            </div>
                                            <?php
                                            $publishedChildCategories = App\Category::where('parentCategoryId', $publishedCategory->id)
                                                ->where('publicationStatus', 1)
                                                ->get();
                                            ?>
                                            @foreach($publishedChildCategories as $childCategory)
                                                <div class="col-sm-3 multi-gd-img">
                                                    <ul class="multi-column-dropdown">
                                                        <li>
                                                            <a href="{{url('/products-by-category/catId='.$childCategory->id)}}">{{$childCategory->categoryName}}</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            @endforeach
                                            <div class="clearfix"></div>
                                        </div>
                                    </ul>
                                </li>
                            @endforeach
                            <li class=" menu__item"><a class="menu__link" href="{{url('/contact')}}">Contact</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
<!-- //banner-top -->

13th August, 2017

Imamul.Hossain left a reply on One More File Is Uploading When I Browse Multiple Image • 2 months ago

I'm using another plugin which is working well, thanks for your co-operations.

12th August, 2017

Imamul.Hossain left a reply on One More File Is Uploading When I Browse Multiple Image • 2 months ago

Thanks for your kind assistance. I'm new in programming. In js or jquery, I'm more weak. Can I use gist as js file directly?

11th August, 2017

10th August, 2017

Imamul.Hossain left a reply on One More File Is Uploading When I Browse Multiple Image • 2 months ago

What can I do now? Give a solution, plz.

Imamul.Hossain left a reply on One More File Is Uploading When I Browse Multiple Image • 2 months ago

@rumm.an thanks for your reply, but it is not working.

Imamul.Hossain started a new conversation One More File Is Uploading When I Browse Multiple Image • 2 months ago

Browsing image file (for example 3 image files) I saw that one more file is displayed if I give command dd($request->all()). Also I saw that last file is coming twice. Running 'for loop' I can upload the files into DB, but are there any good rule to upload the files which is being browsed only? create.blade.php

{!! Form::open(['url' => '/admin/product/save','method'=>'POST','class'=>'form-horizontal','style'=>'padding: 10px','enctype'=>'multipart/form-data']) !!}
                <div class="form-group file-chooser">
                    <label for="productImage">Product Image</label>
                    <span class="file-uploader__message-area"></span>
                    <input type="file" accept="image/*" name="productImage[]" id="productImage"
                           class="file-chooser__input">
                    <span class="text-danger">{{$errors->has('productImage')? $errors->first('productImage'):''}}</span>
                </div>
                <div class="form-group text-center">
                    <button type="submit" class="btn btn-success">Save Product Info</button>
                    <button type="reset" class="btn btn-danger">Reset</button>
                </div>
                {!! Form::close() !!}

js file

//jQuery plugin
(function( $ ) {
   
   $.fn.uploader = function( options ) {
     var settings = $.extend({
       // MessageAreaText: "No files selected.",
       // MessageAreaTextWithFiles: "File List:",
       DefaultErrorMessage: "Unable to open this file.",
       BadTypeErrorMessage: "We cannot accept this file type at this time.",
       acceptedFileTypes: ['pdf', 'jpg', 'gif', 'jpeg', 'bmp', 'tif', 'tiff', 'png', 'xps', 'doc', 'docx',
        'fax', 'wmp', 'ico', 'txt', 'cs', 'rtf', 'xls', 'xlsx']
     }, options );
  
     var uploadId = 1;
     //update the messaging 
      $('.file-uploader__message-area p').text(options.MessageAreaText || settings.MessageAreaText);
     
     //create and add the file list and the hidden input list
     var fileList = $('<ul class="file-list"></ul>');
     var hiddenInputs = $('<div class="hidden-inputs hidden"></div>');
     $('.file-uploader__message-area').after(fileList);
     $('.file-list').after(hiddenInputs);
     
    //when choosing a file, add the name to the list and copy the file input into the hidden inputs
     $('.file-chooser__input').on('change', function(){
        var file = $('.file-chooser__input').val();
        var fileName = (file.match(/([^\\\/]+)$/)[0]);

       //clear any error condition
       $('.file-chooser').removeClass('error');
       $('.error-message').remove();
       
       //validate the file
       var check = checkFile(fileName);
       if(check === "valid") {
         
         // move the 'real' one to hidden list 
         $('.hidden-inputs').append($('.file-chooser__input')); 
       
         //insert a clone after the hiddens (copy the event handlers too)
         $('.file-chooser').append($('.file-chooser__input').clone({ withDataAndEvents: true})); 
       
         //add the name and a remove button to the file-list
         $('.file-list').append('<li style="display: none;"><span class="file-list__name">' + fileName + '</span><button class="removal-button" data-uploadid="'+ uploadId +'"></button></li>');
         $('.file-list').find("li:last").show(800);
        
         //removal button handler
         $('.removal-button').on('click', function(e){
           e.preventDefault();
         
           //remove the corresponding hidden input
           $('.hidden-inputs input[data-uploadid="'+ $(this).data('uploadid') +'"]').remove(); 
         
           //remove the name from file-list that corresponds to the button clicked
           $(this).parent().hide("puff").delay(10).queue(function(){$(this).remove();});
           
           //if the list is now empty, change the text back 
           if($('.file-list li').length === 0) {
             $('.file-uploader__message-area').text(options.MessageAreaText || settings.MessageAreaText);
           }
         });
       
         //so the event handler works on the new "real" one
         $('.hidden-inputs .file-chooser__input').removeClass('file-chooser__input').attr('data-uploadId', uploadId); 
       
         //update the message area
         $('.file-uploader__message-area').text(options.MessageAreaTextWithFiles || settings.MessageAreaTextWithFiles);
         
         uploadId++;
         
       } else {
         //indicate that the file is not ok
         $('.file-chooser').addClass("error");
         var errorText = options.DefaultErrorMessage || settings.DefaultErrorMessage;
         
         if(check === "badFileName") {
           errorText = options.BadTypeErrorMessage || settings.BadTypeErrorMessage;
         }
         
         $('.file-chooser__input').after('<p class="error-message">'+ errorText +'</p>');
       }
     });
     
     var checkFile = function(fileName) {
       var accepted          = "invalid",
           acceptedFileTypes = this.acceptedFileTypes || settings.acceptedFileTypes,
           regex;

       for ( var i = 0; i < acceptedFileTypes.length; i++ ) {
         regex = new RegExp("\\." + acceptedFileTypes[i] + "$", "i");

         if ( regex.test(fileName) ) {
           accepted = "valid";

           break;
         } else {
           accepted = "badFileName";
         }
       }

       return accepted;
    };
  }; 
}( jQuery ));

//init 
$(document).ready(function(){
  $('.fileUploader').uploader({
    MessageAreaText: "No files selected. Please select a file."
  });
});

Browser Displays (4 files where I browsed 3 files) after dd()

array:14 [▼
  "_token" => "se5Us7rRZ1edP95pJodUtheFT4a46ESQ5mXvew6a"
  "productImage" => array:4 [▼
    0 => UploadedFile {#238 ▶}
    1 => UploadedFile {#237 ▶}
    2 => UploadedFile {#240 ▶}
    3 => UploadedFile {#241 ▶}
  ]
]

31st July, 2017

Imamul.Hossain left a reply on Font Problem In Generated Pdf • 2 months ago

@saurabhd, thanks for your reply. I applied all possible ways, but no expected result was found.

9th June, 2017

Imamul.Hossain left a reply on Back Button Problem • 4 months ago

@Borisu and @bashy, thank you........

8th June, 2017

Imamul.Hossain started a new conversation Back Button Problem • 4 months ago

When I logged out from my dashboard, the page is directed to login page, but problem is that if I press back button of browser, the page again goes to previous page where I was. Is session being destroyed or not? How can I prevent this? ''' public function login() { $adminId = Session::get('adminId'); if (isset($adminId)) { return Redirect::to('dashboard')->send(); } else { return view('admin.login'); }

}

public function logout() { Session::put('adminId', NULL); Session::put('message', "You're successfully logged out now!"); return Redirect::to('admin-login'); } '''

10th May, 2017

Imamul.Hossain left a reply on Date/time Is Not Inserted If I Use Format('Y-m-d H:i:s A') • 5 months ago

Thank you @Snapey and glad to get the answer

9th May, 2017

Imamul.Hossain started a new conversation Bengali Font Problem An Article Is Generated As Pdf • 5 months ago

Which 3rd party library is more effective to generate pdf? I used mpdf in OOP (PHP) and dompdf in laravel. When I use dompdf, I found bengali font problem. '??' is coming...............what can I do now?

6th May, 2017

Imamul.Hossain left a reply on Date/time Is Not Inserted If I Use Format('Y-m-d H:i:s A') • 5 months ago

@Jaytee I know, but I want AM/PM not 24 hour format.

Imamul.Hossain started a new conversation Date/time Is Not Inserted If I Use Format('Y-m-d H:i:s A') • 5 months ago

I used several processes:

  1. Carbon class
  2. dateTime class
  3. date('Y-m-d h:i:s A')

If I use 'A' then problem is found.

Imamul.Hossain left a reply on The Requested URL /public Was Not Found On This Server. • 5 months ago

@Snapey Wow, thank u.......

5th May, 2017

Imamul.Hossain left a reply on The Requested URL /public Was Not Found On This Server. • 5 months ago

@Cronix Yes, I add/ commit them

Imamul.Hossain left a reply on The Requested URL /public Was Not Found On This Server. • 5 months ago

@Snapey, I deleted my project folder, everything was deleted. Later I pull them from git, but .env, vendor folder were not found. that is why i could not run my project. I have created another laravel project and copy everything from my previous project into new project. now it is working. thank you so much..........

But now, when I git push the new project, the .env fill and some other files/folders are not pushed. why? the command line says.....The following paths are ignored by one of your .gitignore files: vendor Use -f if you really want to add them.

give me suggestions..........again thank u

4th May, 2017

Imamul.Hossain left a reply on The Requested URL /public Was Not Found On This Server. • 5 months ago

@Snapey I've installed apache.

Imamul.Hossain left a reply on The Requested URL /public Was Not Found On This Server. • 5 months ago

@Snapey you are so helpful I know. Now tell me how to do this.

Imamul.Hossain started a new conversation The Requested URL /public Was Not Found On This Server. • 5 months ago

When I browse localhost and in my project folder, when I clock on public then bellow message is shown. Why? ''' Not Found

The requested URL /public was not found on this server. '''

24th April, 2017

Imamul.Hossain left a reply on Ajax Table Update Inserts
In Database, Why?
• 5 months ago

@Snapey, its not working

Imamul.Hossain left a reply on Ajax Table Update Inserts
In Database, Why?
• 5 months ago

@Snapey , in script: input is like as follows:

<!DOCTYPE html>
<html>
<body onload="loadDoc('','demo')">

<h1>Input</h1>
<input type="text" id="givenInput" onkeyup="loadDoc(this.value,'demo')">
<br><br>
<h1>Output</h1>
<p id="demo"></p>
</body>
</html>

23rd April, 2017

Imamul.Hossain left a reply on Ajax Table Update Inserts
In Database, Why?
• 5 months ago

@Snapey and @jlrdw , It is not laravel. It is atomic project for searching and editing a table using AJAX. I did not find any error but it inserts in database.

Imamul.Hossain left a reply on Ajax Table Update Inserts
In Database, Why?
• 5 months ago

My code:

In class:

<?php
namespace App\W3School\SearchStudent;

use PDO;

class Student
{
    public $host = 'localhost';
    public $user = 'root';
    public $pass = '';
    public $db = 'student';
    public $conn = '';
    public $id = '';
    public $name = '';
    public $mobile = '';
    public $email = '';
    public $text = '';
    public $like = '';

    public function __construct()
    {

        try {
            $this->conn = new PDO("mysql:host=$this->host;dbname=$this->db", $this->user, $this->pass);
        } catch (PDOException $e) {
            echo $e->getMessage();
        }
    }

    public function setData($data = '')
    {
        if (array_key_exists('text', $data) and !empty($data)) {
            $this->text = $data['text'];
        }
        if (array_key_exists('id', $data) and !empty($data)) {
            $this->id = $data['id'];
        }
        if (array_key_exists('name', $data) and !empty($data)) {
            $this->name = $data['name'];
        }
        if (array_key_exists('email', $data) and !empty($data)) {
            $this->email = $data['email'];
        }
        if (array_key_exists('mobile', $data) and !empty($data)) {
            $this->mobile = $data['mobile'];
        }
        if (array_key_exists('like', $data) and !empty($data)) {
            $this->like = $data['like'];
        }
    }
 public function update()
    {
        $sql = "UPDATE `student` SET `name`=:name, `email`=:email, `mobile`=:mobile WHERE `id` = :id;";
        $getSql = $this->conn->prepare($sql);
        $result=$getSql->execute(array(
            ":name"=>$this->name,
            ":email"=>$this->email,
            ":mobile"=>$this->mobile,
            ":id"=>$this->id
        ));
        return $result;
    }
$obj = new Student();
$obj->setData($_GET);
if (!isset($_GET['text'])){
    $obj->update();
}

In AJAX:

 function update(id) {
        var name=document.getElementById('name'+id).innerHTML;
        var email=document.getElementById('email'+id).innerHTML;
        var mobile=document.getElementById('mobile'+id).innerHTML;

        searchPage = 'Student.php?id=' + id+'&name='+name+'&email='+email+'&mobile='+mobile;
        xhttp.open('GET', searchPage);
        xhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById("demo").innerHTML = this.responseText;
            }
        };
        xhttp.send();
    }

Imamul.Hossain left a reply on Ajax Table Update Inserts
In Database, Why?
• 5 months ago

@jlucia I did not do what u r saying.

In class File:

22nd April, 2017

Imamul.Hossain started a new conversation Ajax Table Update Inserts
In Database, Why?
• 6 months ago

From a Student table, when I click on a field and trying to update that field entry, it inserts '' after new data, why?

17th April, 2017

Imamul.Hossain left a reply on How To Remove Public From Laravel 5.4 • 6 months ago

@jlrdw I visited the link you provided......... and thanks for your courtesy..........

Imamul.Hossain left a reply on How To Remove Public From Laravel 5.4 • 6 months ago

@samalapsy I tried it several times, but no css or js is found.

@Snapey could you show me the proper ways, please please....

Finally, many many thanks to those persons who have come forward to help me......

16th April, 2017

Imamul.Hossain started a new conversation How To Remove Public From Laravel 5.4 • 6 months ago

I'm using laravel 5.4. I want to remove public from url. If I move .htaccess and index.php to root folder, no css or js is found. What can I do now?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.