Shaden

Shaden

Member Since 5 Months Ago

Experience Points
6,430
Total
Experience

3,570 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
51
Lessons
Completed
Best Reply Awards
2
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 2
6,430 XP
Sep
21
1 month ago
Activity icon

Replied to Cannot Get 401 For Passport Unauthenticated

Try This:


$url = 'https://yourdomain.com/oauth/token';
$postfileds = [   
    'client_id' => x,
        'client_secret' => 'xxxxxxxxxxxxxxx',
        'username' => '[email protected]',
        'password' => 'xxxxx',
        'grant_type' => 'password',
        'scope' => ''
    ];
$headers = [
    'Content-Type' => 'application/json',
    'Accept'=>'application/json',
          
      ];

        $client_post = new Client([
            'headers' => $headers
        ]);

        $r =  $client_post->request('POST', $url, [
            'form_params' => $postfileds
        ]);

        $response = $r->getBody()->getContents();
        $response = json_decode($response,true);
Jun
23
4 months ago
Activity icon

Replied to Laravel Explode Not Working

better show the rest of the code in this class.

Activity icon

Started a new Conversation Horizon For Laravel 5.6,

I need to install laravel Horizon on Laravel 5.6.

when I install with composer : composer require laravel/horizon

I get the latest version requiring Laravel 5.7

how can I get the Horizon version compatible with 5.6 Thanks

Activity icon

Replied to How To Acess The Data Without Using Foreach Loop In Blade File


$attributename[0]

Would get the first Item in the list; to loop through the rest you unset $attributename[0]; leaving you with the rest of the list for loop.

Activity icon

Replied to Implode(): Invalid Arguments Passed

$request is not an array, you need to convert the Request to an array,

$requestArray = $request->all();
 $computer = implode(",", $requestArray ['computer']);

Activity icon

Replied to Retrieving Information From 3 Tables

You need to setup relation in each model

and use that relation to call each table->related ->item

https://laravel.com/docs/5.8/eloquent-relationships

Jun
21
4 months ago
Activity icon

Replied to Exception Handling

Hi

try this. instead of return response()->json(['message' => 'model not found exec'], 404);



            
        throw new ModelNotFoundException ();
   

Activity icon

Replied to Unlimited Subdomain App With CloudFlare, SSL, Load Balancer, Forge

Hi When using Full,means you have Certificate installed in your server with *.your domain,

If you use Flex would work.

Activity icon

Replied to Customize $message When Validation Failed On `unique`?

@CRONIX - Hi the Original Question is " I am building a JSON API", so your response applies to web response with html Tags, API needs json response.

the Best way to respond with errors in API is to throw an exception and add your exception with what ever message you want to return. BTW that's where you are getting the message ( The given data was invalid ) from, as the validation is using this exception from Laravel exceptions.

 class EmailExistsException extends Exception
{


    public $httpStatusCode = SymfonyResponse::HTTP_BAD_REQUEST;

    public $message = 'An account already exists.';

}

So I would us e something like this in controller


 $validator = Validator::make($request->all(), [
           'unique:users'
        ]);

        if ($validator->fails()) {
            
        throw new EmailExistsException();
        }

Activity icon

Replied to Create Zip For Multiple Files By Chumper/zipper Package

@VINUBANGS - Hi Glad that your code is working now,

Shared Hosting mmmmmm,

if you can ssh to your files I guess you can use composer, if not, you can install manually, follow this

https://laracasts.com/discuss/channels/laravel/install-pacakge-in-laravel-app-on-cpanel

Jun
16
5 months ago
Activity icon

Replied to Add Sub-domains To Forge Sites Deployed On AWS

You would map each subdomain as A record to the same IP address of your AWS server.

or if you are using AWS hostname you use same CNAME for each subdomain.

hope that helps

Activity icon

Replied to Customize $message When Validation Failed On `unique`?

Try This

 $validator = Validator::make($request->all(), [
           'unique:users'
        ]);

        if ($validator->fails()) {
            $message = ' User is not Unique    OR Any Message You want';
            return view('Your View')->withErrors($message);
        }

I guess if you want to return the error in API you need to json encode and return,

Activity icon

Replied to Create Zip For Multiple Files By Chumper/zipper Package

@VINUBANGS - change to

public function createzip($volume_id)
{
      $articles = article::where('volume_id',$volume_id)->get();


    foreach($articles as $article) {
                $files = public_path('storage/upload_pic/'.$article->image);
\Zipper::make(public_path('test.zip'))->add($files);
        } 
       \Zipper ->close(); 
        return response()->download(public_path('test.zip'));

    }
Jun
15
5 months ago
Activity icon

Replied to Can Host A Small Laravel Backend In Cpanel Which Having 500mb Storage??

I guess you can, provided that you have ssh access with putty, and not large database.

Activity icon

Replied to Restricting API To Authorised Clients? (in Addition To User Auth)

You can try look at

https://github.com/apiato/apiato

they have double auth for API

with permissions on what each role can access, using Laravel permissions.

api:auth

Activity icon

Replied to What Do You Think About Apiato?

Just for any late comers

Apiato is great, without doubt the best Platform to use with Laravel for API's and if you want web also.

I think the maker should be awarded fro this great work....

enjoy it.

Activity icon

Replied to Create Zip For Multiple Files By Chumper/zipper Package

I think in your case you need

\Zipper::make(public_path('test.zip'))->add($files);

to be in side the foreach loop, and close the zipper after the close of the loop.

Activity icon

Replied to Create Zip For Multiple Files By Chumper/zipper Package

Hi This is a snipped I use and works fine, maybe will help you

if (count($data['data']) > 30000) {

        $filepath = storage_path('Csvs/');
        $fileCalled = $data['file'] . '-report-';

        $filename = $filepath . $fileCalled;
        $zipfile = $fileCalled . '.zip';


        $chunks = $data['data']->chunk(30000);
    
        $zipper = new \Chumper\Zipper\Zipper;

        $zipper->make($filepath . $zipfile);
        $id = 0;
        foreach ($chunks as $chunk) {

            $file = (new FastExcel($chunk))->export($filename . $id . '.xlsx');
            $zipper->add($file);
            $id++;
        }
        $zipper->close();
        return response()->download($filepath . $zipfile);




    }