sanjayacloud

sanjayacloud

Member Since 4 Months Ago

Experience Points 1,530
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

15 Nov
4 days ago

sanjayacloud left a reply on 500 Error When Deploy A Laravel App

@ How can I mark it?

sanjayacloud left a reply on 500 Error When Deploy A Laravel App

@aurawindsurfing & @munazzil I have sorted it. Thanks for your immediate responds.

sanjayacloud started a new conversation 500 Error When Deploy A Laravel App

Hello,

I got a 500 Error when deploy a laravel app. My laravel version is 5.4. php version is 7.0.31. This is my url:-http://dashboard.magicbox.com.sg/.

Anyone know reason for this error?

14 Nov
5 days ago

sanjayacloud left a reply on How To Do A Form Validation?

@MUNAZZIL - Thanks, It's work.. How can I validate combo box?

sanjayacloud started a new conversation How To Do A Form Validation?

Hello, Can I know, how to do form validate in laravel? My code like below..

Controller method-:

    public function store(Request $request)
    {

        $data = new Product;
        $data->name = $request->name;
        $data->description = $request->description;
        $data->price= $request->price;
        $data->stock = $request->stock;
        $data->product_type = $request->product_type;
        $data->save();
        return back()->with('success', 'Data Your files has been successfully added');

    }

View:-

<form action="" method="post" enctype="multipart/form-data">
                            {{csrf_field()}}
                            @if ($errors->any())
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group">
                                            <label>Name</label>
                                            <input type="text" class="form-control" name="name">
                                        </div>
                                    </div>
                                    <div class="col-lg-6">
                                        <div class="form-group">
                                            <label>Category</label>
                                            <select class="form-control select2" style="width: 100%;" name="category" >
                                                <option selected="selected">Alabama</option>
                                                <option>Alaska</option>
                                                <option>California</option>
                                                <option>Delaware</option>
                                                <option>Tennessee</option>
                                                <option>Texas</option>
                                                <option>Washington</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label>Description</label>
                                    <div class="mb-3">
                                        <textarea id="editor1" name="description" style="width: 100%"></textarea>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-lg-6">
                                        <label>Price</label>
                                        <input type="number" class="form-control" name="price">
                                    </div>
                                    <div class="col-lg-6">
                                        <label>Stock</label>
                                        <input type="number" class="form-control" name="stock">
                                    </div>
                                </div>
                            <div class="row">
                               <div class="col-lg-6">
                                <div class="form-group mt-2">
                                    <label for="exampleInputFile">Single Image</label>
                                    <div class="input-group">
                                        <div class="custom-file">
                                            <input type="file" class="custom-file-input" name="image">
                                            <label class="custom-file-label" for="exampleInputFile">Choose Image</label>
                                        </div>
                                    </div>
                                </div>
                               </div>
                                <div class="col-lg-6"></div>
                            </div>
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group mt-2">
                                            <label for="exampleInputFile">Carousel Images</label>
                                            <div class="input-group">
                                                <div class="custom-file">
                                                    <input type="file" class="custom-file-input" name="image[]">
                                                    <label class="custom-file-label" for="exampleInputFile">Choose Image</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-6"></div>
                                </div>
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group">
                                            <div class="form-check">
                                                <label class="form-check-label">Is this variable product?</label><br>
                                                <div class="form-check form-check-inline">
                                                    <input class="form-check-input" type="radio" name="product_type" value="1" checked>
                                                    <label class="form-check-label">No</label>
                                                </div>
                                                <div class="form-check form-check-inline">
                                                    <input class="form-check-input" type="radio" name="product_type" value="0">
                                                    <label class="form-check-label">Yes</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <!-- /.card-body -->

                            <div class="card-footer">
                                <button type="submit" class="btn btn-primary float-left">Submit</button>
                                <a href="" class="btn btn-danger float-right">Cancel</a>
                            </div>
                        </form>

sanjayacloud left a reply on Multiple Image Upload

@pardeepkumar It's ok. But, How can I upload that file to public/ upload ?

sanjayacloud left a reply on Multiple Image Upload

@georg , I did not find any submit button. I got like below view. please see my screenshot from below link.

https://drive.google.com/file/d/1v--vkqJOrBCoLCKDXegA9Z9rqCGPLXrk/view?usp=sharing

sanjayacloud started a new conversation Multiple Image Upload

Any one know how to upload multiple images in laravel.. I have form with product create. I need upload multiple images for one product.

04 Nov
2 weeks ago

sanjayacloud left a reply on Removing "/public" From URL (Where Does Laravel Get The Base URL From?)

Solution for this issue

rename server.php to index.php at your root directory

Then copy .htaccess file from public folder to root directory. And add below code for that

Options -MultiViews -Indexes

 

RewriteEngine On

 

# Handle Authorization Header

RewriteCond %{HTTP:Authorization} .

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

 

# Redirect Trailing Slashes If Not A Folder...

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} (.+)/$

RewriteRule ^ %1 [L,R=301]

 

# Handle Front Controller...

RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [L]

 

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_URI} !^/public/

RewriteRule ^(css|js|images)/(.*)$ public// [L,NC]

03 Nov
2 weeks ago

sanjayacloud left a reply on How To Do A Config:cache As Automatically

@Snapey . I have it developed localy & upload to my vps...

01 Nov
2 weeks ago

sanjayacloud started a new conversation How To Do A Config:cache As Automatically

Can I know how to do a config:cache as automatically? I am using laravel 5.7...

23 Oct
3 weeks ago

sanjayacloud left a reply on Model Class Not Found Error

@Vilfago That's work. Thank you...

sanjayacloud left a reply on Model Class Not Found Error

@Vilfago I already defined that all variables inside the function.. please look my code above.

//Convert String Date format to mysql date format
        $tempDate = date_create($date1);
        $d1 = date_format($tempDate, $format);

        $tempDate = date_create($date2);
        $d2 = date_format($tempDate, $format);

sanjayacloud left a reply on Model Class Not Found Error

@Vilfago You are correct. I have another error like below.. "ErrorException (E_NOTICE) Undefined variable: d1"

My method..

  public function datePicker(Request $request)
    {
        $format = 'Y-m-d';
        $date = explode(' - ',$request['date']);
        $date1 = $date[0];
        $date2 = $date[1];

        //Convert String Date format to mysql date format
        $tempDate = date_create($date1);
        $d1 = date_format($tempDate, $format);

        $tempDate = date_create($date2);
        $d2 = date_format($tempDate, $format);



    $result1 = Wp_woocommerce_order_item::where('order_item_type' ,'line_item')
        ->whereHas('wp_item_meta', function ($query){
            return $query->where('meta_key','pa_tipo')
                //->where('meta_key', 'Recipient Message')
                ->where('meta_value','gift-pack');})

        ->whereHas('wp_post', function($query1){
            return  $query1->where('post_type', '=' , 'shop_order' )
                            ->whereBetween('post_date', [$d1,$d2]);
        })
        ->get();
    foreach ($result1 as $d){
        $array = array();
        $post = Wp_postmeta::where('post_id',$d->order_id)->get();
        foreach ($post as $p){
            array_push($array,$p);
        }

        dump($d);

        }


    }

sanjayacloud started a new conversation Model Class Not Found Error

Hello every one.. I have got a model class not found error. but that model is there and i have used everywhere in my app.. I got "Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'App\Http\Controllers\App\Wp_woocommerce_order_item' not found" My code as follows..

   public function datePicker(Request $request)
    {
        $format = 'Y-m-d';
        $date = explode(' - ',$request['date']);
        $date1 = $date[0];
        $date2 = $date[1];

        //Convert String Date format to mysql date format
        $tempDate = date_create($date1);
        $d1 = date_format($tempDate, $format);

        $tempDate = date_create($date2);
        $d2 = date_format($tempDate, $format);
    
    $result1 = App\Wp_woocommerce_order_item::where('order_item_type' ,'line_item')
        ->whereHas('wp_item_meta', function ($query){
            return $query->where('meta_key','pa_tipo')
                //->where('meta_key', 'Recipient Message')
                ->where('meta_value','gift-pack');})

        ->whereHas('wp_post', function($query1){
            return  $query1->where('post_type', '=' , 'shop_order' )
                            ->whereBetween('post_date', [$d1,$d2]);
        })
        ->get();
    foreach ($result1 as $d){
        $array = array();
        $post = App\Wp_postmeta::where('post_id',$d->order_id)->get();
        foreach ($post as $p){
            array_push($array,$p);
        }

        dump($d);

        }
        

    }

Look my folder structure. That not found model is there. I have highlighted that class.. Screenshot.. Visit https://drive.google.com/file/d/1mpRju06P9Cmq9fNVX80Kxh1JYH-iquDL/view?usp=sharing

20 Oct
4 weeks ago

sanjayacloud left a reply on Cannot Get Login User Data

@tykus That Route is work. Thanks.. @Cronix Thanks your support also. Thanks both of you..

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix I changed it. But data still null..

sanjayacloud left a reply on Cannot Get Login User Data

@tykus I think Yes. If not covered by the session, How can i do this. I use below class in ProfileController

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;


sanjayacloud left a reply on Cannot Get Login User Data

@Cronix

here's my web.php

<?php



Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', '[email protected]')->name('home');

Auth::routes();

Route::get('/home', '[email protected]')->name('home');

Route::resource('profiles', 'ProfileController');
Route::get('/profile','[email protected]');

sanjayacloud left a reply on Cannot Get Login User Data

@tykus I have properly authenticated and, I can access my user data I my /home page. I I cannot see button or for in my header.

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix , When I go to /login it was redirect to /home.

sanjayacloud left a reply on Cannot Get Login User Data

@tykus I have already authenticated.. And my home controller show all my user details what I print.. This happen in this controller...

@Cronix Yes. My Route is Route::get('/profile','[email protected]');

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix Sorry. I didn't sow it.

a user only be able to see their own profile,

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix @tykus

I have done like this

  public function user()
    {
        $data = auth()->user();
        dump($data);
    }

But I got null. But I have already login this system. And my home controller show my user id,

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix Ok. But my question is how can I redirect to this profile page. Now I pass Id mannually in findOrFail() method like this. $user = User::findOrFail(7). How Can i replace this 7 to current login user id

sanjayacloud left a reply on Cannot Get Login User Data

@Cronix I as your advice, I have do like below. I have pass user id manually. I need this id get from currant login user. Because, This is a user profile. Can you help me to do this.

My method:


$user = User::findOrFail(7);
        dump($user);

sanjayacloud started a new conversation Cannot Get Login User Data

Hi, I am try to get login user data. But I got "Trying to get property of non-object" error..

This my controller

`` public function user(User $id) { $id = Auth::user()->id; $profile = User::findOrFail($id); var_dump($profile);

}

``

This my Route Route::get('/profile/{user}','[email protected]');

02 Oct
1 month ago

sanjayacloud started a new conversation 500 Error PHP Fatal Error: Allowed Memory Size Of 134217728 Bytes Exhausted

Hello Everyone,

I have got a 500 error with "PHP Fatal error: Allowed memory size of 134217728 bytes exhausted"

This my code.

`` public function index() { $result = DB::select("select wp_posts.ID , wp_posts.post_date, wp_posts.post_status, wp_woocommerce_order_items.order_item_id, wp_woocommerce_order_items.order_id, wp_woocommerce_order_items.order_item_name, wp_woocommerce_order_itemmeta.meta_key, wp_woocommerce_order_itemmeta.order_item_id from wp_posts, wp_postmeta, wp_woocommerce_order_items, wp_woocommerce_order_itemmeta where post_type = 'shop_order' and wp_posts.ID = wp_postmeta.post_id"); // $result = Wp_post::where('post_type' , 'shop_order')->get(); return view('admin.lesson.manage')->with('data',$result )->render(); }

``

This Query is work properly in phpmyadmin.

Any one have idea about this..

sanjayacloud started a new conversation Get Data From Wordpress Woocommerce Table

Any one know how to access wordpress woocommerce data from laravel. Please help me..

sanjayacloud left a reply on Undefined Offset: 0 Error

@Vilfago Is there any way to access this value. i have no idea..

sanjayacloud started a new conversation Undefined Offset: 0 Error

Hello everyone, I am trying to get some data from wordpress woocommerce database to laravel view. I did like below query. And i got Undefined offset: 0 (View: E:\xampp\htdocs\projects\client\magicbox_dashboard\resources\views\admin\lesson\manage.blade.php) error.

This is my code

``

@foreach($data as $row)
                        <?php



                        ?>

                            <tr>
                                <td>{{$row->ID}}</td>
                                <td>
                                   {{$row['post_date']}}
                                </td>
                                <td>
                                    {{App\Wp_woocommerce_order_item::where('order_id' , $row->ID)->get()[0]['order_item_name']}}
                                </td>
                                <td>
                                    {{\Illuminate\Support\Facades\DB::table('wp_woocommerce_order_itemmeta')->where('order_item_id', $row->ID)->get()[0]['meta_key']}}
                                </td>
                                <td><?php
                                 $status = $row['post_status'];
                                 if ($status = 'wc-completed'){
                                     echo "Completed";
                                 }else{
                                     echo "Processing ";
                                 }
                                ?>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>

``

17 Sep
2 months ago
15 Sep
2 months ago

sanjayacloud left a reply on Laravel 5.6 App Host On Live Server

@Snapey , I have Linux shared hosting account, with apache & mysql. How can I host on it?

sanjayacloud started a new conversation Laravel 5.6 App Host On Live Server

Hello everyone,

Any one can tell me, how to host a laravel 5.6 app on live server?

sanjayacloud left a reply on Send Email With Default Password When User Register

@Cronix , It's work. Thanks for your support....

sanjayacloud started a new conversation Send Email With Default Password When User Register

Hello everyone,

I am trying to send an email when user register with default password. I am use laravel Mailable. I got below errors.

Undefined index: firstName (View: C:\wamp64\www\commecial\servey-platform\resources\views\emails\welcome.blade.php)

Undefined variable: random_password (View: C:\wamp64\www\commecial\servey-platform\resources\views\emails\welcome.blade.php),

This is my RegisterController

<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use App\Mail\WelcomeMail;
use Illuminate\Support\Facades\Mail;
class RegisterController extends Controller
{
    use RegistersUsers;

    protected $redirectTo = '/home';

    public function __construct()
    {
        $this->middleware('guest');
    }
    
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'firstName' => 'required|string|max:255',
            'lastName' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users',
        ]);
    }
    protected function create(array $data)
    {
        $random_password = str_random(6).time();
        $user= $random_password;
         $user=  User::create([
            'firstName' => $data['firstName'],
             'lastName' => $data['lastName'],
            'email' => $data['email'],
            'password' => Hash::make($random_password),
//            'password' =>$random_password,
        ]);
        Mail::to($data['email'])->send(new WelcomeMail(compact('user')));
        return $user;
    }
}


This is Mailable Controller

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Http\Controllers\Auth\RegisterController;

class WelcomeMail extends Mailable
{
    use Queueable, SerializesModels;

    public $user;

    public function __construct($user)
    {
       $this->user = $user;
    }

    public function build()
    {
        return $this->view('emails.welcome');
    }
}


``

Any one can help me to resolve this error.. 
14 Sep
2 months ago

sanjayacloud left a reply on Cannot Access Upload Images.

@bobbybouwmann I have add like this. `````. But it's not work...

sanjayacloud started a new conversation Cannot Access Upload Images.

Hi all,

I am trying to view my upload images from database. But it not display. It's there in storage/app/upload/lessons folder.

This is my controller

`` public function index() { $lessons = Lesson::all()->toArray(); return view('admin.lesson.manage', compact('lessons'));

}

``

This is my view file

``

ID Name Edit Delete @foreach($lessons as $row) {{$row['id']}} Edit @endforeach ID Name Action ``
12 Sep
2 months ago

sanjayacloud left a reply on Route For One Controller

@Vilfago , It's work for me. And How can i write my show(Lesson $lesson) in my view file?

sanjayacloud left a reply on Route For One Controller

@Vilfago

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', '[email protected]')->name('home');

Route::get('/dashboard', '[email protected]');

Route::resource('lessons', 'LessonController');


I need to access my create() function. How can I assess it?

sanjayacloud left a reply on Route For One Controller

@Vilfago , I tryed like this. http://localhost:8000/lessons/index But I got 404 error

sanjayacloud left a reply on Route For One Controller

@Vilfago After that, How can I access to index or what ever method?

sanjayacloud started a new conversation Route For One Controller

Hi,

I have a crontroller called Lesson. It have methods called index(), create(), store(Request $request), show(Lesson $lesson), edit(Lesson $lesson), update(Request $request, Lesson $lesson), destroy(Lesson $lesson). I need this all methods get to one route. I am beginner to laravel. Any one can help me to do this?

06 Sep
2 months ago

sanjayacloud left a reply on Form Validation Not Work

@NOMGUY

I got below error.

Argument 1 passed to App\Http\Controllers\Controller::validate() must be an instance of Illuminate\Http\Request, array given

sanjayacloud left a reply on Form Validation Not Work

@Cronix

After that I have got below error

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Argument 1 passed to App\Http\Controllers\Controller::validate() must be an instance of Illuminate\Http\Request, array given, called in C:\xampp\htdocs\projects\client\e-learning\app\Http\Controllers\RoleTypeController.php on line 27