saurabhd

Laravel Developer at Individual Contributor

Member Since 2 Years Ago

Ahmedabad

Experience Points
177,480
Total
Experience

2,520 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
1526
Lessons
Completed
Best Reply Awards
34
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

Level 36
177,480 XP
Aug
13
3 months ago
Activity icon

Replied to Index View Isn't Showing

Your layout file path like:

resources/views/layouts/frontLayout/front_design.blade.php

And your index file path like:

/resources/views/index.blade.php
Aug
12
3 months ago
Activity icon

Replied to Adding Items To An Array In A Collection

You should try this:

$coll = new Collection([
    'metrics' => [],
    'dimensions' => [],
]);

$newArray = ["test"=>"details"];

$coll = array_merge($coll,$newArray);
Aug
08
3 months ago
Activity icon

Replied to Getting The Selected Value In A Form Dropdown.

You should try this:

<select name="speakers_id" id="selPsgSpeaker">
                            <option value="" ></option>
                            @foreach($rsltSpeaker AS $krySpkr => $dataSpkr)
                              <option value="{{$dataSpkr->spkrID}}" >{{$dataSpkr->speakerRealName}}</option>
                            @endforeach
                          </select>
Activity icon

Replied to How To Display In Blade Views A Single Record Only (Laravel)

You should try this:

Controller file

$counter2 = Call::where('counter_id', '2')
                    ->latest('updated_at')
                    ->first();

View File

<div style="border-bottom:1px solid #ddd">
          @forelse($counter2 as $two)
          <span id="num2" style="font-size:85px; font-weight:bold;line-height:1.45">
          @if(isset($two->letter))
          {{ $two->letter }}[email protected]{{ $two->number }}</span><br>
          <small id="cou2" style="font-size:35px">Counter 2</small>
          @empty
          <span id="num1" style="font-size:85px;font-weight:bold;line-height:1.45">N/A</span><br>
          @endforelse
        </div>
Activity icon

Replied to How Can I Use Two Different Template For Same Route In Laravel

You should try this:

use Auth;

if(Auth::check()){ 
  return view('loginview');
} else {
  return view('normalview');
}
Activity icon

Replied to Don't Create Field In Database

You should try this:

if(isset($request['repair_report_buro']) && !empty($request['repair_report_buro'])){
$delivery->comments_buro()->create([
        'name' => auth()->user()->firstname,
        'user_id' => auth()->user()->id,
        'message' => $request['repair_report_buro'],
        'icon' => 'fa fa-commenting-o',
        'style' => $position->style,
    ]);
}
Aug
05
3 months ago
Activity icon

Replied to How To Delete Item From Session

Please use forget() for remove item from session like:

$request->session()->forget('abc.xyz.124');

// or use global helper
session()->forget('abc.xyz.124');

Please review this link

Activity icon

Replied to How To Use A Trait In Another Trait ?

You should try like this:

trait A {
    function a() {
        echo "a trait\n";
    }
}

trait B {
    use A;
    function b() {
        echo "b trait\n";
    }

    function a() {
        echo "a fcn from trait B\n";
    }
}

trait C {
    use B;
    function a() {
        echo "a fcn from C trait\n";
    }

    function b() {
        echo "b fcn from C trait\n";
    }
}


class AClass {
    use A;
}
Aug
01
3 months ago
Activity icon

Replied to Laravel Controller

You should try this:

Route::resource('admin/tbooking','TbookingController', ['except' => 'store']);
Activity icon

Replied to Ignore Blank Field On Update

You should try this:

// All posted data except token and id
$data = request()->except(['_token','id']);

// Remove empty array values from the data
$result = array_filter($data);

// update record
DB::table($table)->where('id', $arr)->update($result);
Activity icon

Replied to Route In Http

Please follow this link

Activity icon

Replied to Get Parent Of Parent In Laravel Eloquent

You should try this:

$departments= Departments::with(['organizations','divisions'])->get();

foreach($departments as $department){

    echo $department->organizations->title;

}
Jul
31
3 months ago
Activity icon

Replied to Compare Only Month And Year In Db And Fetch Records

You should try like this:

$post = Mjblog::whereYear('created_at', '=', $year)
              ->whereMonth('created_at', '=', $month)
              ->get();
Activity icon

Replied to ERR_TOO_MANY_REDIRECTS

Because you have to created same name route (i.e software_new/public/) so please update route and also please follow this link

Jul
30
3 months ago
Activity icon

Replied to "Undefined Offset: 0"

You should try this:

public function store(Request $request, SiteSetting $sitesetting){

  foreach(array_except($request->toArray() , ['_token'  , 'submit']) as $key => $req) {
      $sitesettingupdate = $sitesetting->where('nomsetting' , $key)->get();
      $sitesettingupdate->fill(['valeur'=>$req])->save(); 

  }
          return Redirect::back()->withFlasMessage('les parametres sont bien modifieé');

}
Activity icon

Replied to Personal Access Token

jwt.php in config folder

Jul
29
3 months ago
Activity icon

Replied to Personal Access Token

Please set your expiration time in jwt.php file in ttl variable.

'ttl' => 60,
Activity icon

Replied to Redirect After Login

You should try this like:

public function redirectTo(Request $request)
    {
        if(Auth::check()) {
            if(Auth::user()->is_admin) {
                return redirect('admin');
            }
            if(Auth::user()->user) {
                return redirect('home');
            }
        }
        return redirect('/');
    }
Activity icon

Replied to Checking If Unique Comination Of Fields Exist In Database

Please update your validation with unique field.

public function store(Request $request) { 
    $this->validate($request, [

        'authorName'=>'required|min:3|unique:author',
        'authorAge'=>'required|numeric|min:16|max:120|unique:author',
        'authorAddress'=>'required|min:3|unique:author',
        'bookName'=>'required|min:2',
        'date'=>'required|date',

    ]);
---------------------
---------------------
}
Jul
26
3 months ago
Activity icon

Replied to Object Of Class Illuminate\Routing\Redirector Could Not Be Converted To String

You should try this like:

ob_start();
include 'test.php';
$string = ob_get_clean();
Activity icon

Replied to Route Not Defined

Please update link like:

\ create.blade.php

<a class="btn btn-primary" href="{{ route('client.createjobs.jobs') }}"<> Back</a>
Jul
25
3 months ago
Activity icon

Replied to Dynamic Prefix Routing

You should try this:

Route::group(['prefix' => 'front'], function() {
    authRoutes(); 
    Route::get('/', '[email protected]');
});

Route::group(['prefix' => 'front1'], function() {
    authRoutes(); 
    Route::get('/', 'FrontOneCon[email protected]');
});

Route::group(['prefix' => 'admin'], function() {
    authRoutes(); 
    Route::get('/', '[email protected]');
});

function authRoutes()
{
    Route::get('login', 'Auth\[email protected]')->name('login');
}
Activity icon

Replied to Laravel Passport

You should follow this link

Jul
23
3 months ago
Activity icon

Replied to Filter Model Entry Laravel Collection

You should try this:

$allUsers = Users::query();
        foreach ( array_keys($arrayColumns) as $key ) {
            if ($key === 'column' || $key === 'Two' || $key === 'Three') {
        $allUsers->where($key, 1)
        }
            if ($key === 'date' || $key === 'dateTwo' ) {
        $allUsers->where($key, '!=',null)
        }
    }

$allUsers->all();
Jul
22
3 months ago
Activity icon

Replied to Route [fileUpload] Not Defined. (View: C:\wamp64\www\ckcmain12\resources\views\layouts\dashboard.blade.php)

Your route like:

Route::group(['middleware' => 'web'], function () { 
 Route::get('fileUpload', function () { return view('fileUpload'); }); Route::post('fileUpload', ['as'=>'fileUpload','uses'=>'[email protected]'])->name('fileUpload');

});
Jul
15
4 months ago
Activity icon

Replied to If Condition Is Not Working

You should try this:

public function store(Request $request)
 {
    $this->validate($request, [

        'title' =>'required',
        'link'=>'required',
        'date_time'=>'required',
        'featured'=>'mimes:jpeg,pdf,docx,png:5000',
        'file'=>'mimes:jpeg,pdf,docx,png:5000',
        'content'=>'required',
        'category_id'=>'required',
    ]);

  
    $data = [

        //'link'=>$request->link,
        'title'=>$request->title,
        //'content'=>$request->content,
        'category_id'=>$request->category_id,
        'slug'=>str_slug($request->title),
        'date_time'=>Carbon::parse(strtotime($request->date_time))->format('Y-m-d'),
        ];

    if($request->link)
    {
        $link=request('link');
        $data['link']=Post::create($data);
    }
    if($request->content)
    {
        $link=request('content');
        $data['content']=Post::create($data);
    }

    if ($request->featured)
    {
        $featured = request('featured');
        $file_name = time() . $featured->getClientOriginalName();
        $featured->move('uploads/posts', $file_name);
        $data['featured'] = 'uploads/posts/'.$file_name;
    }
   
    if ($request->hasFile('file')) {
        $file = $request->file('file');
        $file_name = time() . $file->getClientOriginalName();
        $file->move('uploads/posts', $file_name);
        $data['file'] = 'uploads/posts/'.$file_name;
    }
  
   $post = Post::create($data);
    Session::flash('success', 'New Blog has been Published on Website for Particular Menu');
    return redirect()->back();

}
Jul
12
4 months ago
Activity icon

Replied to Display Name Based On User ID

Your function code like:

$vqosces = Vqosce::with('users')->get();

Your view file code like:

 @foreach ($vqosces->reverse() as $vqosce)

                            <th class="min-width-60"><a href="\vqosces\{{ $vqosce->id }}">{{ $vqosce->candidate }}</a></th>
                            <th class="min-width-60">{{ $vqosce->name }}</th>
                            <th class="min-width-80">{{ $vqosce->result }}</th>
                            <th class="min-width-80">{{ $vqosce->created_at->format(config('app.date_format')) }}</th>
                            <th class="min-width-80"><a href="\vqosces\{{ $vqosce->id }}\edit">Edit</a></th> 
                        </tr>
                    </tr>
                @endforeach


Jul
11
4 months ago
Activity icon

Replied to All() Vs Get() - Laravel Eloquent

User::all() and User::get() will do the exact same thing.

all() is a static method on the Eloquent\Model. All it does is create a new query object and call get() on it. With all(), you cannot modify the query performed at all (except you can choose the columns to select by passing them as parameters).

get() is a method on the Eloquent\Builder object. If you need to modify the query, such as adding a where clause, then you have to use get(). For example, User::where('name', 'David')->get();

Activity icon

Replied to Undefined Variable: Products For PDF

You should try this:

public function downloadPdf()
{

    $products = Product::all();

    $pdf = PDF::loadView('admin.pdf.product-pdf', compact('products'));

    return $pdf->download('catalogue.pdf');
}
Activity icon

Replied to Redirecting A Route

You should try this:


return view('restaurants.show',compact($restaurant));

Note: restaurants.show is not route but it's path for view show file

Jul
10
4 months ago
Activity icon

Replied to StoreAs Not Working

You should try this:

$relPathAndName = $file->storePubliclyAs('/public/products', $product_id.'.jpg');

return str_replace('public', 'storage', $relPathAndName);

//Then to use it later: 
asset('storage/products/product_id.jpg')