laravelyv

laravelyv

Member Since 8 Months Ago

Experience Points 230
Experience Level 1

4,770 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

08 May
1 month ago

laravelyv left a reply on Sending Mail With Attachments In Laravel 5.7

I have changed my controller method with the mail sending feature and still the mail is not attaching attachments.

$objDemo = new \stdClass(); $objDemo->from = '[email protected]'; $objDemo->name = $request->name; $objDemo->company = $request->company; $objDemo->date = date('Y-m-d h:i:s'); $objDemo->position = $request->position; $objDemo->comments = $request->message; $objDemo->subject ='TypeFocus: Thank-you email'; $objDemo->action ='Write Thank You Mail'; $attachments = array(); if(isset($request->checkvals) && !empty($request->checkvals)) { $check_values = $request->checkvals; foreach ($check_values as $val) { //$file_value[] = public_path() .'/user_files/'.$val; $attachments[] = [ 'file' => public_path() .'/user_files/'.$val, 'options' => [ 'mime' => '', 'as' => 'docs' ] ]; } } // if(!empty($file_value)){ // $objDemo->attach(implode(",",$file_value),['as' => 'display', 'mime' => $mime]); // } Mail::to($to)->send(new Thankyou($objDemo,$attachments));

laravelyv left a reply on Sending Mail With Attachments In Laravel 5.7

Someone please help me to resolve this. Thanks.

laravelyv started a new conversation Sending Mail With Attachments In Laravel 5.7

I am submitting a form and selecting the attachments from the list of files. In my controller I am sending the mail like below.

in my controller method

$to = $request->email; if ($to!="") { $objDemo = new \stdClass(); $objDemo->from = '[email protected]'; $objDemo->name = $request->name; $objDemo->company = $request->company; $objDemo->date = date('Y-m-d h:i:s'); $objDemo->position = $request->position; $objDemo->comments = $request->message; $objDemo->subject ='TypeFocus: Thank-you email'; $objDemo->action ='Write Thank You Mail'; $file_value = array(); if(isset($request->checkvals) && !empty($request->checkvals)) { $check_values = $request->checkvals; foreach ($check_values as $val) { $file_value[] = public_path() .'/user_files/'.$val; } } if(!empty($file_value)){ $objDemo->attach(implode(",",$file_value),['as' => 'display', 'mime' => $mime]); } Mail::to($to)->send(new Thankyou($objDemo));

Also in my app mail php I have created like this.

public function build() {

    return $this->view('emails.thankyou_email')
    ->with([

    ]);
   
}

resources/views/emails i have created the view like this.

@if($thankyou->action=='Write Thank You Mail')

 

NOTE: to reply to the sender of this email, you have to use their email address, not "[email protected]"

 

Name: {{$thankyou->name}}

Company: {{$thankyou->company}}

Position: {{$thankyou->position}}

Date:{{$thankyou->date}}

Message: {{$thankyou->comments}}

TypeFocus Careers Program.

@endif

Now only added the attachment feature in my controller method and I am getting an error - Call to undefined method stdClass::attach()

Can someone please help me to resolve the issue. If I remove the attachment code from the controller method the mail is working fine. I need to attach the selected files in my mail. Please help me.

14 Oct
8 months ago

laravelyv left a reply on 405 Error

I have changed the resource option from the route file and gave proper function URLs in the web.php. Still all ajax call in my edit page is going wrong.

I gave this URL - http://127.0.0.1:8000/clients/generatecode1

But the call is going to http://127.0.0.1:8000/clients/edit/generatecode1

Someone please help me. Thanks.

13 Oct
8 months ago

laravelyv left a reply on 405 Error

My add/edit feature is working based on this route - Route::resource('clients','Admin\ClientController');

There is no separate route for add and edit.

Can someone help me to resolve the issue? Thanks.

laravelyv left a reply on 405 Error

These are the routes for clients in my web.php

Route::resource('clients','Admin\ClientController'); Route::any('clients1/{alphabet}', 'Admin\[email protected]')->name('alphabets'); Route::post('clients/generatecode','Admin\[email protected]_code'); Route::post('clients/generatecode1','Admin\[email protected]_code'); Route::post('clients/generatecontractdate','Admin\[email protected]_contract_date')->name('expiryDate'); Route::any('clients/export/{id}', 'Admin\[email protected]')->name('export'); Route::any('clients/csvexport', 'Admin\[email protected]')->name('clientexport'); Route::any('clients/deleteClient', 'Admin\[email protected]')->name('deleteClient');

laravelyv left a reply on 405 Error

I have corrected the above issue in my "add clients" page. But the same code I am using my in my edit code. User will reach this edit page by this link - {{ route('clients.edit',$client->id) }}.

In my web.php for calling ajax code I am using this route.

Route::post('clients/generatecontractdate','Admin\[email protected]_contract_date')->name('expiryDate');

This is successfully working with your above solution.

But in edit page I am using the same above URL in my ajax call.

When I debug the Network option in the browser the URL is going to

http://127.0.0.1:8000/clients/1/generatecode and I am getting 404 error page error. But I don't have any URL like this. No idea why its going to this URL. Someone please help me on this. Thanks.

laravelyv started a new conversation 405 Error

I hvae created a route in my laravel5.7 web.php as

Route::post('clients/generatecontractdate','Admin\[email protected]_contract_date')->name('expiryDate');

In my controller I created a Function

public function generate_contract_date() { echo "reached"; exit; }

When I call the above function through jquery ajax like below.

function generate_con_date() { var length_val=parseInt($('#ClientContractLength').val()); if(!isNaN(length_val)) { var startDate = $('#datepicker').val() loadUrl = "expiryDate"; $.post( loadUrl, {query_length_val: length_val,contract_date: startDate}, function (responseText){

           //alert(responseText);
           $("#ClientExpiryDate1").val(responseText);

         },
         "html"
         );
}

}

I am getting a POST http://127.0.0.1:8000/clients/generatecontractdate 405 (Method Not Allowed) in my jquery error.

Can someone help me to reolve this. Thanks in advance.

07 Oct
8 months ago

laravelyv left a reply on Route Not Defined

Thanks. Ok. I will integrate it with jquery popup.

laravelyv left a reply on Route Not Defined

I have updated the post with the issue I am facing. Please check and comment it. Thanks.

laravelyv left a reply on Route Not Defined

Actually I need to show a confirmation pop up for delete the record. So I created this blade remove.blade.php. When user clicks on this link

Delete

It should open a pop up window (remove.blade.php). My remove.blade.php html is like below.

@extends('products.layout')

@section('content') @csrf @method('PUT')

     <div class="row">
        Are you sure, Do you want to delete this record?
        <div class="col-xs-12 col-sm-12 col-md-12 text-center">
          <button type="submit" class="btn btn-primary">Submit</button>
        </div>
    </div>

</form>

@endsection

When the user submits the button only the record should be deleted. For this functionality I have created the delete as a link in the index.blade.php and am getting the error.

laravelyv started a new conversation Route Not Defined

Hi, I have created a new laravel5.7 project. I have created a new controller named ProductController.php with all product actions functions.

Also created a a route in web.php as Route::resource('products','ProductController');

Created these blades under resources/views/products 1. layout 2. index 3. create 4. edit 5. remove and 6. show.

In the index.blade.php I have these three links for 1. show 2. edit 3. Delete like below.

Show Edit Delete

When I add the last link for Delete I am getting this error - "Route [products.remove] not defined. (View: /opt/lampp/htdocs/test1/resources/views/products/index.blade.php)

I have checked the php artisan route:list and its not showing the remove in the list. I have cleared all cache too.

I am new to Laravel and unable to rectify the issue. Can someone please help me on this? Thanks in advance.