durairaj

Member Since 6 Months Ago

Experience Points
730
Total
Experience

4,270 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 Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 1
730 XP
Apr
10
4 weeks ago
Activity icon

Replied to How To Get Condition Based Data Between Nested Relationsiop Hasmany In Laravel

thanks man , you save lot of my code. thank you very much for quick replay.

Activity icon

Started a new Conversation How To Get Condition Based Data Between Nested Relationsiop Hasmany In Laravel

Enrollments model:

public function schedule_weeks() {
        return $this->hasMany( Enrollment_weeks::class, 'enrollment_id', 'id' )->where( 'enrollment_weeks.status', 'ACTIVE' );
    }

Enrollment_weeks Models:

public function week_classes() {
        return $this->hasOne( Enrollment_week_classes::class, 'enrollment_week_id', 'id' );
    }

if i give without where condition i got proper nested data

$enrol_info            = Enrollments::with( [ 'student_info', 'schedule_weeks.week_classes'  ] )->find( $id );

if i give where condtion i got error

$enrol_info                     = Enrollments::with( [ 'student_info', 'schedule_weeks.week_classes' => function( $query ) {
                                                $query->where( 'enrollment_weeks.order', '>=', '1' );
                                                $query->where( 'enrollment_weeks.order', '<=', '3' );
                                            }  ] )

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'enrollment_weeks.order' in 'where clause' (SQL: select * from `enrollment_week_classes` where `enrollment_week_classes`.`enrollment_week_id` in (52, 53, 54, 55, 56, 57, 58, 59, 60) and `enrollment_weeks`.`order` >= 1 and `enrollment_weeks`.`order` <= 3)

but if i gave like this

$enrol_info                     = Enrollments::with( [ 'student_info', 'schedule_weeks' => function( $query ) {
                                                $query->where( 'enrollment_weeks.order', '>=', '1' );
                                                $query->where( 'enrollment_weeks.order', '<=', '3' );
                                            }  ] )

i got data without nested weekclass data

pls help me to get nested weekclass data with condition

Mar
03
2 months ago
Activity icon

Awarded Best Reply on The Image Must Be An Image.

after somany search i found solution

vendor\laravel\framework\src\Illuminate\Validation\Concerns\ValidatesAttributes.php

public function validateImage($attribute, $value)
    {
        return $this->validateMimes($attribute, $value, [ 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp' ]);
    }

here i added jpg in first it will upload images.

thanks for helping me

Activity icon

Replied to The Image Must Be An Image.

after somany search i found solution

vendor\laravel\framework\src\Illuminate\Validation\Concerns\ValidatesAttributes.php

public function validateImage($attribute, $value)
    {
        return $this->validateMimes($attribute, $value, [ 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp' ]);
    }

here i added jpg in first it will upload images.

thanks for helping me

Activity icon

Started a new Conversation The Image Must Be An Image.

The image must be an image. this error shows on only live server otherwise localhost it is uploading files

In form.blade.php

<form method="POST" action="{{ route( 'slider.store' ) }}" enctype="multipart/form-data">
    
                @csrf

                <div class="col-sm-6">
        <div class="form-group">

            <label for="image">
                Image <span class="text-danger">*</span>
            </label>
            <input type="file" name="image" class="form-control-file" />

            @if( isset( $slider_info ) && $slider_info->image )
                <div>
                    <img style="width: 100px; height: 50px;" src="{{ asset( 'storage/' . $slider_info->image ) }}" />
                </div>
            @endif

        </div>
    </div>
                <div>
                    <button type="submit" name="create_slider" class="btn btn-sm btn-success">Create Slider</button>
                    <a class="btn btn-sm btn-danger" href="{{ route( 'slider.index' ) }}">Back</a>
                </div>

            </form>

In controller

public function store( Request $request ) {
        
        $rules[ 'title' ]               = 'required';
        $rules[ 'image' ]               = 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048';
        $post_data[ 'title' ]           = $request->title;
        
        if( $request->hasFile( 'image' ) ) {
            $fileData                   = $request->only( 'image' );
            $file                       = $fileData[ 'image' ];
            $post_data[ 'image' ]       = $file;
        }

        $validator                  = Validator::make( $post_data, $rules );
        
        if ( $validator->fails() ) {

            return redirect()->back()->with( 'errors', $validator->errors() )->withInput();

        } else {

            if( $request->hasFile( 'image' ) ) {
                $file                           = $request->file( 'image' )->store( 'slider' );
                $validated_data[ 'image' ]      = $file;
            }

            $validated_data[ 'title' ]          = Input::get( 'title' );
            

            Slider::create( $validated_data );


            return redirect()->back()->with( 'status', 'Slider added successfully!' );

        }

    }

any type image uploading this error will come.

pls tell me how to solve this problem

Jan
29
3 months ago
Activity icon

Replied to How To Run Schedule Job In Ipower Panel

ipower did provide laravel support. thanks for your idea.

Activity icon

Started a new Conversation How To Get Image Using Taggable

enquiry model

class Enquiry extends Model
{
    protected $fillable = [ 'company_name', 'address', 'name', 'email', 'contact', 'designation', 'message', 'user_id', 'file' ];

    public function workshops()
    {
        return $this->morphedByMany(Workshop::class, 'enquiry_taggable');
    }
    public function exhibitions()
    {
        return $this->morphedByMany(Exhibition::class, 'enquiry_taggable');
    }
    public function products()
    {
        return $this->morphedByMany(Product::class, 'enquiry_taggable');
    }

enquiry_taggable model

class EnquiryTaggable extends Model
{
   
}

product model

class Product extends Model
{   
    protected $table    = 'vendor_products';
    protected $fillable = [ 'user_id', 'category', 'brand', 'name', 'price', 'description', 'affiliate_link', 'slug', 'weight', 'material', 'modal_number', 'manufacture_country', 'others' ];

    public function tags()
    {
        return $this->morphToMany(Enquiry::class, 'enquiry_taggable');
    }
    
    public function images() {
        return $this->hasMany( 'App\ProductImage', 'product_id' )->latest();
    }

in controller

$enquiry                        = Enquiry::where( 'user_id', $buyer_id  )
                                            ->distinct()
                                            ->get();
        
        

        
        if( $enquiry ){
            
            foreach( $enquiry as $enq ) {
                
            
                $products               = $enq->products;
				// here  get product details but product image not stored in product table, image stored in product image table
 	}              
}

how to i show image form productImage table, becaus image saved in productImage table not in product table.

Pls help me,

Jan
27
3 months ago
Activity icon

Started a new Conversation Mail Not Sent

sendgrid mail not sending with any email given

MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
SENDGRID_API_KEY=*******************************************
MAIL_ENCRYPTION=tls
MAIL_USERNAME=apikey
MAIL_PASSWORD=**********************

mail not sending with default mail . pls help me to send mail

Jan
25
3 months ago
Activity icon

Replied to How To Run Schedule Job In Ipower Panel

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

i don't know where do add above line in ipower control panel.

Activity icon

Started a new Conversation How To Run Schedule Job In Ipower Panel

Cannot run schedule job in ipower panel server

URL to Access: http://rrawfood.ipower.com/public_html/shop/artisan schedule:run

Run this job:

Daily on Minute 1 of Every Hour we set it on ipower panel server but not working

/// kernal.php

protected function schedule(Schedule $schedule)
    {
        $schedule->command('command:cancelsubscription')
                 ->everyMinute();
     
    }

//console/commands/cancelsubscription

public function handle()
    {
        $data[ 'name' ]     = 'durair';
        $data[ 'message' ]  = 'teseting';
        Test::create( $data );
    }

how to run on schedule job on ipower panel , pls help me

Jan
09
4 months ago
Nov
17
5 months ago
Activity icon

Started a new Conversation Class 'PhpOffice\PhpSpreadsheet\Reader\Xlsx' Not Found

In local system it working

on live server it is not working

i copied vendor/phpoffice

paste in server vendor folder in composer.json

"require" : {
	 "phpoffice/phpspreadsheet": "^1.15",
}

in controller

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use App\Traits\CommonTrait;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;

use Maatwebsite\Excel\Facades\Excel;

use App\Imports\ExcelImport;

use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use App\Codes;


use DB;
class ImportController extends Controller

how do i resolve this error , also maatwebsite got same error. Please tell me how to do it. in local system working fine

Activity icon

Started a new Conversation Class 'PhpOffice\PhpSpreadsheet\Reader\Xlsx' Not Found

In local system it working

on live server it is not working

i copied vendor/phpoffice

paste in server vendor folder in composer.json

"require" : {
	 "phpoffice/phpspreadsheet": "^1.15",
}

in controller

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use App\Traits\CommonTrait;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;

use Maatwebsite\Excel\Facades\Excel;

use App\Imports\ExcelImport;

use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use App\Codes;


use DB;
class ImportController extends Controller

how do i resolve this error , also maatwebsite got same error. Please tell me how to do it. in local system working fine

Activity icon

Replied to Cannot Insert Last Insert Id

Thank you . i worked.

Activity icon

Started a new Conversation Cannot Insert Last Insert Id

$pro_ins[ 'user_id' ]                  = $vendor_id;
 $pro_ins[ 'brand' ]                     = null;
$pro_ins[ 'name' ]                      = $product_name ?? null;
$pro_ins[ 'slug' ]                      = str_slug( $product_name, '-' );
                                    
$product                            = Product::create( $pro_ins );
                                    
$img[ 'product_id' ]                = $product->id;
 $img[ 'primary_at' ]                = now();
$img[ 'path' ]                      = $logo;

 $images                         = ProductImage::create( $img );
dd( $img );
 ```                       	

i'm facing
Illegal string offset 'product_id'

i don't know
product inserted in product table.