sanjayacloud

Member Since 2 Years Ago

Experience Points
8,610
Total
Experience

1,390 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
13
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 2
8,610 XP
Mar
20
2 months ago
Activity icon

Replied to Cannot Upload At Least More Than 10 MB Video In Laravel.

Can I know, How can I do that? I have no idea about that.

Activity icon

Started a new Conversation Cannot Upload At Least More Than 10 MB Video In Laravel.

Hi Friends,

I am trying to upload a video to Vimeo from my laravel app, While it's upload I have Got error 'PHP message: PHP Warning: POST Content-Length of 15036024 bytes exceeds the limit of 8388608 bytes error.

Any solution for this?

Here is my upload method:-

`` public function store(Request $request) { ini_set('memory_limit','8G');

    Validator::make($request->all(), [
        'title' => 'required',
        'lesson_type' => 'required',
        'description' => 'required',
    ])->validate();

    if (request()->resources){
        $resources = time().'.'.request()->resources->getClientOriginalExtension();
        request()->resources->move(public_path('resources'), $resources);
    }

    if($request->hasFile('file')){
        set_time_limit(0);
        $response=$this->client->upload($request->file,[
            "name"=>$request->title,
            'privacy'=>[
                'view'=>'anybody',
                'download' => false,
            ]
        ]);
    }

    if($request->hasFile('file')) {
        $lesson = new Lesson();
        $lesson->course_id = $request->course_id;
        $lesson->title = $request->title;
        $lesson->lesson_type = $request->lesson_type;
        $lesson->content = $request->contents;
        $lesson->description = $request->description;
        $lesson->video_link = $response;
        $lesson->resources = request()->resources ? $resources : null;
        $lesson->save();
        $id = $lesson->id;
    }
    else{
        $lesson = new Lesson();
        $lesson->course_id = $request->course_id;
        $lesson->title = $request->title;
        $lesson->lesson_type = $request->lesson_type;
        $lesson->content = $request->contents;
        $lesson->description = $request->description;
        $lesson->resources = request()->resources ? $resources : null;
        $lesson->save();
        $id = $lesson->id;

    }
    return back()->with('success', 'Lesson added to your list');

}

``

Anyone can help me with this?

Mar
13
3 months ago
Activity icon

Replied to Displaying A Rating As Stars

Very useful thanks @snapey

Mar
07
3 months ago
Activity icon

Replied to Cannot Access Storage Files From Public Folder (403 Forbidden Error)

@usmanbasharmal Here is my view

``

 <div class="col-md-10 offset-1">
            <div class="card">
                <div class="card-header">
                    Existing Categories
                </div>

                <div class="card-body">
                    <div class="table-responsive">
                        <table class=" table table-bordered table-striped table-hover datatable-User">
                            <thead>
                            <tr>
                                <th width="10"></th>
                                <th>#</th>
                                <th class="text-center">Name</th>
                                <th class="text-center">Image</th>
                                <th class="text-center">Description</th>
                                <th class="text-center">Status</th>
                                <th class="text-center">Action</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($categories as $key => $category)
                                <tr data-entry-id="{{ $category->id }}">
                                    <td></td>
                                    <td>{{ $category->id ?? '' }}</td>
                                    <td>{{ $category->name ?? '' }}</td>
                                    <td>

                                        <img width="100" src="{{asset($category->getFirstMedia('category')->getUrl('thumb'))}}" alt="Thumbnail">
                                    </td>
                                    <td>
                                        {{$category->description}}
                                    </td>
                                    <td class="text-center align-middle">
                                        @if($category->status==0)
                                        <span class="badge badge-primary p-2">Active</span>
                                        @else
                                            <span class="badge badge-danger p-2">Inactive</span>
                                         @endif
                                    </td>
                                    <td class="text-center align-middle">
                                        
                                        <div class="btn-group">
                                            <a class="btn btn-xs btn-info" href="{{ url('admin/category/edit/'. $category->id) }}">Edit</a>
                                            <a class="btn btn-xs btn-primary" href="{{ url('admin/category/sub-category/'. $category->id) }}">Sub Categories</a>
                                        </div>

                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

``

Activity icon

Replied to Cannot Access Storage Files From Public Folder (403 Forbidden Error)

I have run php artisan storage:link --relative

It said The "--relative" option does not exist.

Please note I am using laravel 6

Activity icon

Replied to Cannot Access Storage Files From Public Folder (403 Forbidden Error)

@sr57 I sow below error in the server error log

Got error 'PHP message: PHP Warning: symlink(): Permission denied in

Activity icon

Replied to Cannot Access Storage Files From Public Folder (403 Forbidden Error)

I have checked it. But the is no error in the error log.

Activity icon

Started a new Conversation Cannot Access Storage Files From Public Folder (403 Forbidden Error)

Hello everyone ,

I have hosted one of my sites on digital ocean with Plesk.

Now I am trying to access my uploaded (Using Laravel-medialibrary ) images from the public folder it's getting

Forbidden You don't have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I have set permission to storage path as 777 and also I have run php artisan storage:link successfully.

This happened for my new uploading files. This is work what I have already uploaded files.

Anyone can help me no this?

This is my filesystem config file

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => 'local',

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => 's3',

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "s3", "rackspace"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root'   => storage_path('app'),
        ],
        
        'public' => [
            'driver'     => 'local',
            'root'       => storage_path('app/public'),
            'url'        => env('APP_URL') . '/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key'    => env('AWS_KEY'),
            'secret' => env('AWS_SECRET'),
            'region' => env('AWS_REGION'),
            'bucket' => env('AWS_BUCKET'),
        ],
        'media' => [
            'driver' => 'local',
            'root'   => public_path('media'),
        ],

    ],

];


Feb
28
3 months ago
Activity icon

Replied to Spatie Media Library Call To A Member Function AddMedia() On Bool

Thanks. I totally forgot that line.

Activity icon

Started a new Conversation Spatie Media Library Call To A Member Function AddMedia() On Bool

HI Guys,

I am having a problem in Spatie Media Library while updating the image 'it's showing the below error.

Call to a member function addMedia() on bool

Here is my update method:

public function update(Request $request, $id)
    {
        Validator::make($request->all(), [
            'name' => 'required',
            'description' => 'required',
        ])->validate();

        $category = Category::find($id)->update([
            'name' => $request->name,
            'slug' => Str::slug($request->name, '-'),
            'image' => 'Test',
            'description' => $request->description,
        ]);

        if ($request->image == !null){
            $category->addMedia($request->image)->toMediaCollection('category');
        }
        return back()->with('success', 'Category updated.');
    }

Also here Is my Model:


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

class Category extends Model implements HasMedia
{
    use HasMediaTrait;

    protected $fillable = ['name', 'slug', 'image', 'description', 'status'];

    public function registerMediaCollections()
    {
        $this->addMediaCollection('category')
            ->withResponsiveImages()
            ->singleFile();
    }

    public function registerMediaConversions(Media $media = null)
    {
        $this->addMediaConversion('thumb')
            ->width(400)
            ->height(400)
            ->sharpen(10);
    }
}

Anyone can help me with this?

Feb
27
3 months ago
Activity icon

Started a new Conversation Cannot Upload Image Using Spatie Media Library

Hi Guys,

I am trying to upload images using the spatie media library. But I am getting the below error while I am trying to upload an image.

Argument 1 passed to Spatie\MediaLibrary\FileAdder\FileAdder::processMediaItem() must be an instance of Spatie\MediaLibrary\HasMedia\HasMedia, instance of App\Model\Category given, called in C:\wamp64\www\projects\2021\laravel\edexa\vendor\spatie\laravel-medialibrary\src\FileAdder\FileAdder.php on line 364

Here is my model

<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;

class Category extends Model
{
    use HasMediaTrait;

    protected $fillable = ['name', 'slug', 'description', 'status'];

}

Hire is my upload function.

public function store(Request $request)
    {
        Validator::make($request->all(), [
            'name' => 'required',
            'image' => 'required',
            'description' => 'required',
        ])->validate();
        
        $category = Category::create([
            'name' => $request->name,
            'slug' => Str::slug($request->name, '-'),
            'description' => $request->description,
        ]);
        $category->addMedia($request->file('image'))->toMediaCollection('category');;
        return back()->with('success', 'Category created.');
    }

Anyone can help me with this?