shariff

shariff

junior web developer at Bangalore

Member Since 1 Year Ago

bangalore

Experience Points
7,820
Total
Experience

2,180 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
35
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.

Level 2
7,820 XP
Oct
23
23 hours ago
Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@sinnbeck You are right it was from server error. It is a new cpanel so the .env file was hidden. after changing setting configuration it was working fine.

Thank you very very much for guiding me if u were not telling about server error I should have wasting more time in that. Thank you once again.

Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@majdiden @jjoek The error is from laravel log and that error was encountered earlier.

Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

In logs the last error is this.

[2020-10-22 09:45:11] local.ERROR: Invalid route action: []. {"exception":"[object] (UnexpectedValueException(code: 0): Invalid route action: []. at C:\xampp\htdocs\starship\vendor\laravel\framework\src\Illuminate\Routing\RouteAction.php:91)
Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@sinnbeck thanks for your response. In logs it is not showing anything if I hit the API.

Activity icon

Started a new Conversation Internal Server Error 500 While Calling POST API (Laravel)

Hi, I have created one POST API for sending mails. When I am calling this API I am getting an error like this

Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error full detail error

error:
message: "Server Error"
__proto__: Object
headers: Ep
lazyInit: ()=> {…}
arguments: (...)
caller: (...)
length: 0
name: ""
__proto__: ƒ ()
[[FunctionLocation]]: main-es2015.6970d90….js:1
[[Scopes]]: Scopes[4]
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error"
name: "HttpErrorResponse"
ok: false
status: 500
statusText: "Internal Server Error"
url: "http://starshipllp.com/starship-backend/public/api/sendEmail"

my controller

public function sendMail(Request $request)
     {
         $data = $this->validate($request,[
             'name' => 'required',
             'email' => 'required',
             'phone' => 'required',
             'address' => 'required',
             'orders' => 'required',
             'grandTotal' => 'required'
         ]);

         $emails = [$request->email,'[email protected]'];

         Mail::to($emails)->send(new SendOrderEmail($data));

         return response()->json(['success' => true,'data' => 'Order Placed Successfully']);
     }

I don't know what is wrong in my code.

Sep
07
1 month ago
Activity icon

Started a new Conversation Handle Method Is Not Triggering In Laravel Queue

Hi

While running php artisan queue:work the handle method is not working in jobs. I am using QUEUE_CONNECTION=database . I don't know why the handle method is not working. I tried all the commands.

php artisan queue:work
php artisan queue:listen

php artisan config:cache 

controller

public function store(Request $request)
    {
         $this->validate($request,[
            'description' => 'required'
        ]);

        $communication =  Communication::create([
            'member_type' => $request->membertype_text,
            'description' => $request->description
        ]);

        $emails = Member::where('member_type',$request->member_type)->get(['email']);

        dispatch(new CommunicationJob($communication,$emails));

        return redirect('communications')->with('success','Email Send Successfully');

    }

jobs handle method

public function handle()
    {
       //return redirect('/');
        Mail::to($this->emails)->send(new CommunicationMail($this->communication));
    }

Please help me

thank you

Aug
22
2 months ago
Activity icon

Replied to Laravel Media Library Error While Adding Media To Database

@ajithlal Thank you very much. I got stuck in this from last 4 hours. thank you once again

Activity icon

Started a new Conversation Laravel Media Library Error While Adding Media To Database

Hi,

I just started with laravel media library. While adding media to the database I am getting an error. I tried searching in documentation But I am not finding an answer for this.


Argument 1 passed to Spatie\MediaLibrary\MediaCollections\FileAdder::processMediaItem() must be an instance of Spatie\MediaLibrary\HasMedia, instance of App\Service given, called in C:\xampp\htdocs\Matheen\furniture_backend\vendor\spatie\laravel-medialibrary\src\MediaCollections\FileAdder.php on line 372

controller

public function store(Request $request)
    {
        $service = Service::create([
            'service_name' => $request->service_name
        ]);

        $file = $request->file('image');
        $service->addMedia($file)->toMediaCollection('services');

        return redirect('services')->with('success','Service Added Successfully');

    }

Model

use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\HasMedia;


class Service extends Model
{
    use InteractsWithMedia;

     protected $fillable = ['service_name'];


    public function registerMediaCollections(): void
    {
        $this->addMediaCollection('services');
    }

     public function registerMediaConversions(Media $media = null): void
     {
        $this->addMediaConversion('thumbnail')
            ->width(1000)
            ->height(250);
     }


}
Aug
07
2 months ago
Activity icon

Replied to Array To String Conversion (While Seeding The Data In Database)

@sinnbeck Thank you very much. Both are working


$faker->paragraph(3) //
$faker->paragraphs(3, true) 

Activity icon

Started a new Conversation Array To String Conversion (While Seeding The Data In Database)

Hi,

I Just started learning laravel seeder. While seeding the data in database I am getting an error like below. I am not understanding why this error is coming. Please help me.

 Array to string conversion

  at C:\xampp\htdocs\Matheen\furniture_backend\vendor\laravel\framework\src\Illuminate\Support\Str.php:449
    445| 
    446|         $result = array_shift($segments);
    447| 
  > 449|             $result .= (array_shift($replace) ?? $search).$segment;
    450|         }
    451| 
    452|         return $result;
    453|     }

  1   C:\xampp\htdocs\Matheen\furniture_backend\vendor\laravel\framework\src\Illuminate\Support\Str.php:449
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Array to string conversion", "C:\xampp\htdocs\Matheen\furniture_backend\vendor\laravel\framework\src\Illuminate\Support\Str.php")

ProductSeeder

public function run()
    {
        $products = factory(\App\Product::class,100)->create(); 

        $faker = Faker::create();
        $imageUrl = $faker->imageUrl(640,480, null, false);

        foreach($products as $product){

            $product->addMediaFromUrl($imageUrl)->toMediaCollection('products');

        }


Factory

use App\Product;
use Faker\Generator as Faker;

$factory->define(Product::class, function (Faker $faker) {

    return [
        'user_id' => 2,
        'furniture_name' => $faker->name,
        'furniture_cate' => 1,
        'furniture_price' =>$faker->numberBetween(1000, 90000),
        'descrip' => $faker->paragraphs(3,false) ,
        'delivery_time' => $faker->numberBetween(1,10),
    ];

});


Thank you

Jul
23
3 months ago
Activity icon

Replied to Get_class() Expects Parameter 1 To Be Object, Null Given (Yajra Datatable)

@sergiu17 you are right eloquent relationship was returning null. that why it is giving an error. thank you very very much. it is working now. I have made changes in the relationship.

Activity icon

Started a new Conversation Get_class() Expects Parameter 1 To Be Object, Null Given (Yajra Datatable)

HI,

When I am retrieving data using yajra datatable I am getting an error like below. Same code for other things it's working. I don't know what is wrong with the below code. Please help me.

exception: "ErrorException"
file: "C:\xampp\htdocs\usermanagement\vendor\yajra\laravel-datatables-oracle\src\DataTables.php"
line: 63
message: "get_class() expects parameter 1 to be object, null given"

controller

 public function index(Request $request)
    {

        $data = Lead::find($request->leadid)->notes;

        return Datatables::of($data)
        ->addColumn('actions','lead.notebutton')
        ->rawColumns(['actions'])
        ->addIndexColumn()
        ->make(true);


    }

thank you

Jun
30
3 months ago
Activity icon

Started a new Conversation Laravel Query To Get A Unique Records With Sum Of Value.

Hello everyone,

I have one to many relationship where one user has many stocks.

user model

class User extends Authenticatable
{
    use Notifiable, HasRoles;

    public function stocks()
    {
        return $this->hasMany(Stock::class,'user_id');
    }
    
}

I am storing stock in stocks table like below

user_id
item_id
quantity

I want to retrieve stocks with unique Items with sum of quantity. I am not understanding how to calculate the sum of quantity. I can able to get unique items. Please help to get a sum of quantity.

controller file

public function index()
    {
        $stock = User::find(Auth::user()->id)->stocks()->get()->keyBy('item_id');
        return view('stocks.index',compact('stock'));
    }

blade file

      @php($i=1)
                    @foreach($stock as $stk)
                    <tr>
                        <td>{{$i}}</td>
                        <td>{{\App\Item::find($stk->item_id)->item_name }}</td>
                        <td>{{$stk->quantity}}</td>
                    </tr>
                    @php($i++   )
     @endforeach

thank you