Niyaz

Experience

520

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

19th July, 2018

Niyaz started a new conversation Upload A Csv File And , Store And Retrieve It Into The View Page • 1 month ago

Hi can anyone help me to import CSV file into the database and retrieve it and show the content into a view and also generate a pdf format of that view blade I have created the form for it.

28th June, 2018

Niyaz left a reply on To Send Multiple PDF Attachment In Single Mail • 1 month ago

Hey Thanks for your help And i have found the mistake done by me and rectified it It is just the mistake of file extension.

Niyaz left a reply on To Send Multiple PDF Attachment In Single Mail • 1 month ago

Well. everything is working fine but im not getting the file as pdf file it shows some content in pdf file as

%PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R /Count 1 /Resources << /ProcSet 4 0 R /Font <<  /F1 8 0 R /F2 9 0 R /F3 10 0 R /XObject <<  /I1 11 0 R /I2 13 0 R /MediaBox [0.000 0.000 595.280 841.890] endobj 4 0 obj [/PDF /Text /ImageC ] endobj 5 0 obj /Producer ( /CreationDate (D:20171008171519+04'00') /ModDate 

i guess i have probelm with "mime" this is my code

$pdf = PDF::loadView('pdf.request', ['request' => $data]);
            $sendData = array(
                'data'  => $data
                );
            $response = Mail::send('emails.appro_email_template', $sendData, function ($message) use ($pdf, $sendData) {
                $message->from($sendData['data']->email, $sendData['data']->name);
                $message->to($sendData['data']->email, $sendData['data']->name);
                $message->subject('form approval');
$file = public_path('assets/img/form.pdf');
                $message->attachData($pdf->output(), $sendData['data']->unit_no."_request.pdf");
$message->attach($file, array ( 'as' => 'My-second.php',
                     'mime' => $file->getMimeType() ) 
                    );
            });

also tired

'mime' => 'application/pdf')

and how can i convert the raw data into a pdf format as attachments kindly provide me a solution

Thank you

27th June, 2018

Niyaz left a reply on To Send Multiple PDF Attachment In Single Mail • 1 month ago

Hy i tried as you said Everything works fine but the pdf is not loaded

cannot be loaded

this is my code

$pdf = PDF::loadView('pdf.request', ['request' => $data]);
            $sendData = array(
                'data'  => $data
                );
            $response = Mail::send('emails.appro_email_template', $sendData, function ($message) use ($pdf, $sendData) {
                $message->from($sendData['data']->email, $sendData['data']->name);
                $message->to($sendData['data']->email, $sendData['data']->name);
                $message->subject('form approval');
                $message->attachData($pdf->output(), $sendData['data']->unit_no."_request.pdf");
$message->attachData('http://localhost/form/public/assets/img/form.pdf',"mysecond.pdf");
            });

do i have do anything to get the original extension of file

Niyaz left a reply on To Send Multiple PDF Attachment In Single Mail • 1 month ago

my first file is in

resources
 -- views
  -- pdf
   -- request.blade.php

and second file is in

resources
  -- img
  --  comsume.pdf

i can get 1st file in pdf as attachment in my mail function and how to get the 2nd file to along with 1st in the mail (i.e) 2 attachment in pdf format

Suggest me an idea

26th June, 2018

Niyaz started a new conversation To Send Multiple PDF Attachment In Single Mail • 1 month ago

Hi previously I have been doing adding single attachment in an email but now i need to do it as multiple Pdf attachments in a single mail

This is my code

$pdf = PDF::loadView('pdf.request', ['request' => $data]);
            $sendData = array(
                'data'  => $data
                );
            $response = Mail::send('emails.appro_email_template', $sendData, function ($message) use ($pdf, $sendData) {
                $message->from($sendData['data']->email, $sendData['data']->name);
                $message->to($sendData['data']->email, $sendData['data']->name);
                $message->subject('form approval');
                $message->attachData($pdf->output(), $sendData['data']->unit_no."_request.pdf");
            });

can anyone tell me do it for multiple attachment Suggest me as i can use for loop or the something else, if so please guide me

24th June, 2018

Niyaz started a new conversation To Get The Values Of Dropdown Option From Database And Display It In My Blade Template • 1 month ago

I am doing a form using laravel I already have a function to get the data from the database but now I need to display a sentence by the 2nd dropdown

This is my 1st dropdown select option

 <div class="form-group">
                            {{ Form::select('community_id',[ '1' => 'prop1', '2' => 'prop2', '3' => 'prop3' , '4' => 'prop4'], null, ['class' => 'form-control' , 'onchange' => 'prop(this.value);', 'id' => 'community-select-dropdown' ]) }}

and my 2nd drop down is the data that is from my database

like if I select "prop1" from 1st dropdown I get the values(name) from the database that is to only for "prop1"

This is my jquery function to fetch and display the name on 2nd dropdown

function prop(value)
    {
        var model = $('#building-no-block');
        organizationAction(value);
        agree();
        if (value == 1 || value == 6) {
            $.get('http://localhost/workpermit/api/get-buildings/'+value, function(data) {  
                model.empty();
                    var option = '';
                    $.each(data.result, function(index, element) {
                    option +="<option value='"+ element.room_name +"'>" + element.room_name + "</option>";
                })
                    console.log(option);
                    model.append('<select id="building-select-dropdown" name="building_no" class="form-control"><option>Select Building</option>'+option+'</select>');
                   
                    
            });
            } else {
                    model.empty();
                    model.append('<input type="text" name="building_no" class = "form-control" placeholder = "Building No">');
                }

    }

And my query is to display a sentence as a div id in my blade template as " A deposit of (room_name) is necessary" so whenever i click different room_name from my 2nd dropdown that has to be changed in a "deposit of (room_name) is necessary" too

Can anyone help me to find the better solution for it even by laravel controller or by jquery

21st June, 2018

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

I tried this

$('input[name="community_id"],input[name="category_of_works"]').change(function () { 
    var community = $('input[name="community_id"]').val();
    var category = $('input[name="category_of_works"]').val();
    var secdepo ;

    if (community == 2 && category == 0) {
             secdepo ='<li>A refundable security deposit of AED 500.00 </li>'
      } else {
        secdepo = '<li>A refundable security deposit of AED 5,000.00 </li>'
       }
        $('#secdepo').empty().append(secdepo);
});

and in my blade

<label class="col-xs-3 control-label">Terms and Conditions</label> 
                            <div class="col-xs-9">
                                <div class="agree-terms">  
<ul>
<div id="secdepo"></div>
<li>I understand xxxxxxxxxxxxxx.</li>
                                        <li>I confirm that xxxxxxxxxxxxxxxxxxxxxx</li>
                                        <li>I confirm that xxxxxxxxxxxxxx.</li>
 </ul>
                                </div>
                            </div>

but still didn't get it

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Tried but didn't get the line in terms and condition

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Also console.log will help me whether it is running or not please tell me how to do that to?

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Yes, there is no error But i don't find any changed in my agree-terms (class) I changed some of the code as per my wish as

jQuery('input[name="community_id",input[name="category_of_works"]').change(function(){
 
var $community = jQuery('input[name="community_id"]');
var $category = jQuery('input[name="category_of_works"]');
var $secdepo = jQuery('#sec-depo')

if($community.val() == 2 && $category.val() == 0) {
  if(secdepo.length == 0){
    jQuery('.agree-terms ul').append('<li id="sec-depo">A refundable security deposit of AED 500.00.</li>')
  } 
} else {
   $('.agree-terms ul').append('<li id="sec-depo">A refundable security deposit of AED 5,000.00 .</li>')
}
});

I used id instead of class Is there any error

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Hi

I am getting an error after trying the code on my console as

jquery is not defined

i tried in many ways to solve it but cannot find the solution

20th June, 2018

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Sorry since i'm new to php. I'm asking a hell lots of questions to you? Hope i will get used to php

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Also i can clearly understand your code But cannot understand this

if ($hugeDepo.length == 0) {

where does the "length" comes from

Niyaz left a reply on How To Implement Different Condition For Different Dropdown In Form • 1 month ago

@yorki Thank you for your reply .. :)

I have three doubt :

  1. should i have to put it into a function and trigger as onchange or as simply like your code
  2. can i use "$" instead of "jquery" , because i used it perviousely
  3. will this code will effect my previous code since i have used it as a separate code and trigger by onchange function in my select option

Please give me a better idea

Niyaz started a new conversation How To Implement Different Condition For Different Dropdown In Form • 1 month ago

Hi, i am doing a project in laravel which i need implement different condition for different dropdown (select option) Like , this is my 1st dropdown list option

{{ Form::select('category_of_works', ['0' => 'Minor Works', '1' => 'Major Works'], null , ['class' => 'form_control'])  }}

and this is my 2nd dropdown list option

{{ Form::select('community_id',[ '1' => 'Project1', '2' => 'Project2', '3' => 'Project3' , '4' => 'Project4'],null ,['class' => 'form-control'] ) }}

My query is if i select "minor works" from 1st dropdown and "Project2" from 2nd dropdown i have to get a sentence like "Your deposit is huge" in my terms and condition

And my Terms and condition is

<label class="col-xs-3 control-label">Terms and Conditions</label> 
                            <div class="col-xs-9">
                                <div class="agree-terms">  
<ul>
<li>I understand xxxxxxxxxxxxxx.</li>
                                        <li>I confirm that xxxxxxxxxxxxxxxxxxxxxx</li>
                                        <li>I confirm that xxxxxxxxxxxxxx.</li>
 </ul>
                                </div>
                            </div>

Perviously, i have similar condition for one dropdown and i did it by javascript and query . But now i have it for 2 dropdown and i dont know how to proceed it.

Can anyone help me to solve it as i can do it by query or by laravel( php) ?

18th June, 2018

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

@mvd

Thank you very much for your help All my requriements is working

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

Yes @mvd ,

i did as per your code used switch, case, breaks in every line

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

Hi

I tried using the controller

$statusInfo = array(
            1 => 'Re-activation',
            2 => 'Re-activation, Additional access',
            3 => 'Re-activation, Additional access, Lost',
            4 => 'Re-activation, Additional access, Lost, Damaged',
            5 => 'Re-activation, Additional Access, Lost, Damaged, Replacement'
         );

and on my blade


@foreach( $request->request_status as $status)
               @if (isset($statusInfo[$status]))
               {{ $statusInfo[$status] }}
             @else
               None of them is selected
            @endif
            @endforeach 

But my output is

Reason For Request:
 None of them is selected None of them is selected None of them is selected

It displays 3 times "None of them selected" instead of values

And this is my database table and their column is

  id            Name                      request_status

  1              niyaz                        ["1","2","3"]

Have to retrieve the values of "request_status"(column) into my blade template in the name as mention above.

And last but not the least , those values("1,2,3") are my checkbox value

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

Hi @mvd ,

I tried your code of using switch in my blade And got the output as :

 Reason For Request :
 @switch ($status) @case(5) Re-activation, Additional Access, Lost, Damaged, Replacement

Instead of only displaying Reactivation,Additional Access, Lost, Damaged, Replacement

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

Hi @mvd ,

I tried your code of using switch in my blade And got the output as :

''' Reason For Request : @switch ($status) @case(5) Re-activation, Additional Access, Lost, Damaged, Replacement

''' Instead of only displaying Reactivation,Additional Access, Lost, Damaged, Replacement

Niyaz left a reply on To Retrieve The Array Value From Database To My View Blade • 2 months ago

Thank you for the replies since i'm new to laravel .And i have an another query like can i have if condition to print different item

Here is my code

Reason For Request @foreach( $request->request_status as $status) @if ($status == 1 && $status == 2 && $status == 3 && $status == 4 && $status == 5) Re-activation, Additional Access, Lost, Damaged, Replacement @elseif ($status == 1 && $status == 2 && $status == 3 && $status == 4) Re-activation, Additional access, Lost, Damaged @elseif ($status == 1 && $status == 2 && $status == 3) Re-activation, Additional access, Lost @elseif ($status == 1 && $status == 2) Re-activation, Additional access @elseif ($status == 1) Re-activation @else None of them is selected @endif @endforeach Please re-correct and provide me a better solution Thank you

14th June, 2018

Niyaz started a new conversation To Retrieve The Array Value From Database To My View Blade • 2 months ago

array:13 [▼ "_token" => "K5eGLUL5zZDaemAKZljf2FuA44Qxb1oA8yqnxbWX" "community_id" => "1" "name" => "nias" "building_no" => "54" "unit_no" => "" "mobile" => "984" "email" => "" "request_status" => array:4 [▼ 0 => "1" 1 => "2" 2 => "3" 3 => "4" ] "vehicle_one" => "" "registration_one" => "" "vehicle_two" => "" "registration_two" => "" "agree" => "agree" ]

Here is my input from my form and I need to get the values of the array in the name "request_status" from the database to my view blade how to get it? anyone knows about it

Edit Your Profile
Update

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