Giter VIP home page Giter VIP logo

Comments (9)

nicolasvahidzein avatar nicolasvahidzein commented on May 25, 2024

Just to give you more details, this is what i get when i do not use any "use" statement at the top since you are not saying we should use any.

[2018-07-10 02:54:44] local.ERROR: Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found {"userId":1,"email":"[email protected]","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found at D:\WebServer\ZeinTekWebServices\liveroot\Merlin Core\app\Http\Controllers\API\ContactsIndividualsController.php:916)
[stacktrace]

My controller is in a folder called API, not at the root where default controllers are located.

I'm using laravel 5.5 btw.

What am i doing wrong please?

from php-initial-avatar-generator.

warlof avatar warlof commented on May 25, 2024

you either have to call the class this way : \LasseRafn\InitialAvatarGenerator\InitialAvatar or with the use statement at top of your class.

from php-initial-avatar-generator.

nicolasvahidzein avatar nicolasvahidzein commented on May 25, 2024

Hello Warlof, i tried that as well last night doing this:

use LasseRafn\InitialAvatarGenerator\InitialAvatar; (at the top of my controller)

and this in the function:

			$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();

			$imageData = $avatar	->name('Lasse Rafn')
									->length(2)
									->background('#8BC34A')
									->generate();

But i still get an error, this one:

[2018-07-10 11:45:31] local.ERROR: Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found {"userId":1,"email":"[email protected]","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found at D:\WebServer\ZeinTekWebServices\liveroot\Merlin Core\app\Http\Controllers\API\ContactsIndividualsController.php:916)
[stacktrace]

I think it is because i have my controllers not at the root but in a folder called "API" but i don't see why it doesn't work, my other classes are good and this class is in the vendor section. Any ideas?

from php-initial-avatar-generator.

warlof avatar warlof commented on May 25, 2024

that wasn't what I wrote upper.

either one or the other; not a mix of both.

if you're not using the use statement; you should write :
$var = new \Namespace\Class();

if you're using the use statement; you should write :
$var = new Class();

That's PSR4 and PHP basics :/

from php-initial-avatar-generator.

nicolasvahidzein avatar nicolasvahidzein commented on May 25, 2024

so i don't use this line then?

$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();

How do i instantiate a new avatar then?

$avatar = InitialAvatar::????

Please i know i am close.

Thank you in advance.

from php-initial-avatar-generator.

warlof avatar warlof commented on May 25, 2024
<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller;
use LasseRafn\InitialAvatarGenerator\InitialAvatar;

class AbstractController extends Controller
{
    public function get()
    {
        $avatar = new InitialAvatar();
        $avatar->name('Warlof Tutsimo')->size(32)->rounded()->generate();
    }
}

from php-initial-avatar-generator.

nicolasvahidzein avatar nicolasvahidzein commented on May 25, 2024

Thanks a million!!!!!!!!!!!!!!!! You are wonderful Loic. Much appreciated. Have a wonderful day.

from php-initial-avatar-generator.

LasseRafn avatar LasseRafn commented on May 25, 2024

I'll build a Laravel wrapper soon 👍

from php-initial-avatar-generator.

LasseRafn avatar LasseRafn commented on May 25, 2024

Coming up: https://github.com/Rackbeat/laravel-ui-avatars

from php-initial-avatar-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.