domioanna

domioanna

Bradford, West Yorkshire, England

Hire Me

Member Since 5 Years Ago

Experience Points 94,890
Experience
Level
Lessons Completed 937
Lessons
Completed
Best Reply Awards 3
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

30 Jan
10 months ago

domioanna left a reply on Switch A Production Site From One Github Repo To Another

You know what, I never even thought of the @bobbybouwmann, yet it makes perfect sense! Thank you for that. I like the 'new server' idea, then as you say it's just a simple database switch and repointing DNS.

Thank you! :D

domioanna started a new conversation Switch A Production Site From One Github Repo To Another

I know this isn't specifically a 'Laravel' related question, but this seems like the most reliable place to get a response.

I run a Saas web app that's on a production server, but it was originally built on Laravel 5.2 and I've progressively upgraded as time has gone on.

But as you can imagine, after a few years things are starting to get a little messy in the codebase and also some Laravel elements won't work such as Laravel Mix.

I'm wanting to start from scratch and rebuild the whole system, upgrading things such as Vue (still on v1.0), etc but how would I go about switching over from one Github repo to another?

Everything goes through Forge and Envoyer. Any help or recommendations would be deeply appreciated

02 Sep
1 year ago

domioanna left a reply on Laravel Horizon Not Loading In Production, Showing 'Parse Error' In WaitTimeCalculator.php

Restarted nginx... seems to have fixed it as it's started working :D

domioanna left a reply on Laravel Horizon Not Loading In Production, Showing 'Parse Error' In WaitTimeCalculator.php

I have @Hawkleaf, there've been a couple of people having issues locally, which have been fixed by updating PHP or Laravel Valet.

I'll see if anything comes back on Github :)

domioanna started a new conversation Laravel Horizon Not Loading In Production, Showing 'Parse Error' In WaitTimeCalculator.php

I've installed Laravel Horizon on my application and deployed to production. I've followed all of the instructions and the server is running on PHP version 7.1.8 (using Forge & Envoyer).

When I load Horizon, it shows infinite spinners. Check Dev Tools, it shows an error calling api/stats and api/workload.

When I look at the error I see

FatalThrowableError
Parse error: syntax error, unexpected '='
in WaitTimeCalculator.php (line 75)

This is on line 75 of WaitTimeCalculator.php

[$connection, $queueName] = explode(':', $queue, 2);

Any ideas?

05 Jan
1 year ago

domioanna started a new conversation Converting JSON To A CSV File

Is there a way, in Laravel or via a package, to take a JSON feed and turn it into a CSV file that can be emailed?

I'm trying to streamline and automate areas of my business, so if there is a way that on the first each month to generate and email a CSV file with different data from the website in, that would be amazing.

I know how to do all the other bits, but the conversion of JSON data into a CSV file is the bit I'm struggling with.

21 Dec
1 year ago

domioanna left a reply on Global Variable In Controller

So you could set a session variable like this...

session(['key' => 'value']);

You would set key as the variable name and value as the value you want to retrieve.

Then, to retrieve it elsewhere you would put...

$value = session('key');

You may want to set a default just incase one wasn't set, like this...

$value = session('key', 'default');

Does that make any more sense?

20 Dec
1 year ago

domioanna left a reply on Calculate Field Value Before Save

Are the numbers 1 and 4 saved in a different field in the database?

Could you not dynamically create the image_name whenever that image is called rather than saving it in the database?

Something like:-

$image_name = "img_" . $relationship1->id . "-" $relationship2->id;

Then have this dynamically generated everytime you call an image?

domioanna left a reply on Vim Users... Emmet.vim And <tab>

This is a Test

domioanna left a reply on Has Many Through Relationship / Many To Many Relationship

Class --< Students >--< Subjects

Class has many Students Student belongs to Class

Student has many Subjects Subject has many Students

For the latter, you're going to need an intermediary table with a 'belongs to many' relationship.

Read https://laravel.com/docs/5.3/eloquent-relationships#many-to-many for more information on this. :)

domioanna left a reply on Has Many Through Relationship / Many To Many Relationship

Are the Class - Subject related at all?

08 Jul
2 years ago

domioanna started a new conversation Vim Users... Emmet.vim And <tab>

I have Vim set up to use Emmet, and I've set the key to trigger it. Just a pre-requisite, I also have Ultisnips installed.

When I open a HTML or even a .blade.php file to edit from first opening Vim, and insert (as an example) ".test" and hit it does nothing. However, if I open my .vimrc file, write it and close it, then go back and do the same thing in the HTML / blade.php file.... it works!

No idea why, but if anyone else has encountered this or has a set up where they can utilise Emmet without issue I'd be really interested in your help.

18 Mar
2 years ago

domioanna left a reply on Envoyer Deployment Failing: Unable To Resolve Github

Sorry @bashy, what do you mean by 'add another DNS'? How would you set this up?

domioanna started a new conversation Enjoyer Deployment Failing:

Trying to deploy using Laravel Envoyer, but getting this error.

--2016-03-18 14:10:00--  https://api.github.com/repos/...
Resolving api.github.com (api.github.com)... failed: Name or service not known.
wget: unable to resolve host address ‘api.github.com’
  • I've removed the actual github URL as it had my access token and private repo in it

Any ideas?

06 Feb
2 years ago

domioanna started a new conversation Stripe And Invoices

I'm launching an app next week that uses Laravel, Cashier and Stripe.

I'm also now VAT Registered, and need a way to be able to generate some form of report of all invoices generated and payments taken over a given period.

Does anyone know of any ready-made solutions / CRM that integrated with Stripe and offers this kind of functionality?

I've seen some CRMS systems like Agile that integrate with Stripe but I don't know if they do what I need.

Thanks.

27 Jan
2 years ago

domioanna left a reply on Setting Currency In Cashier 6.0

Incase anyone else has this same issue, here's how I got around it (thanks to @phroggyy on SlackChat)

I've put this into my AppServiceProvider@boot method.

Cashier::formatCurrencyUsing(function ($amount) {
    $amount = number_format($amount / 100, 2);
            
    if (starts_with($amount, '-')) {
        return '-£ '.ltrim($amount, '-');
    }

    return '£ '.$amount;
});

domioanna started a new conversation Setting Currency In Cashier 6.0

I know how to do this in 5.0, but the same code doesn't work in 6.0.

Does anyone know how to change the default "$" / "usd" in Cashier to use "£" / "gbp" without having to edit the core files?

Using:- Larval 5.2 Cashier 6.0

26 Jan
2 years ago

domioanna left a reply on L5 Folder Structure Best Practice

I was looking for a "standard" for this idea, but I think it's more of a project-preference issue. I've made a project where I just put them into a Models folder, but I also have a project where I have different namespaces and a folder for each (as an example, a Posts folder with a model class file for Posts, Comments, Tags, if that makes sense).

If it works for your project, do it.

17 Jan
2 years ago

domioanna started a new conversation News On Spark Release?

I know this question has probably been asked hundreds of times, but I don't suppose anyone has any news on the Spark release date? I don't like to hassle Taylor on Twitter too much as I have a feeling lots of others do and I bet he'll be getting sick of it.

I'm desperate (and for financial reasons, NEED) to release an app and I'm holding off until Spark is released so any news anyone may have would really help.

I apologies to Taylor as I deeply appreciate all of the work he puts in to create someone amazing that allows us all to create these wonderful projects. The things I've been able to do because of Laravel is amazing, things I would have never thought possible, and Spark will open up a whole other world to me to really capitalise!

17 Dec
2 years ago

domioanna started a new conversation "Watch" Or "Follow" A Conversation

Sometimes there are conversations or questions asked that I notice and think... "I've had that issue, I'd love to know how the community could fix it". So I leave it for a couple of days and then return to find the outcome, only to realise that I can't find the original conversation...

Or maybe a conversation that has a particular hint or solution that I feel would benefit a project but I'm not at my machine at that time, I seem to lose it when I'm back into that project.

Maybe it's just me, but I think having the ability to add a conversation to a 'Watch" or "Follow" list for later referral, and then whenever there's a reply or a Marked Solution I would receive a notification.

domioanna left a reply on Ajax Delete Function

If you're not hitting the controller, maybe it's an issue with your routing?

domioanna left a reply on Ajax Delete Function

Check your Console or Network tab in your Web Inspector for any errors.

08 Dec
3 years ago

domioanna started a new conversation Broadcast / Emit Event On One Component, Listen On Another

I have 2 (unrelated) components that are being loaded on one page and I need a method on Component A to broadcast an event which Component B can catch and run it's own logic when it's fired.

Is it possible to use something like this.$broadcast or this.$emit on one component and have another (unrelated) component listen for when it's called?

If so, how?

28 Oct
3 years ago

domioanna left a reply on Deployment Failing: Composer\Util\Filesystem::$filesystem

Never mind, I didn't realise one of the packages I was pulling in was pulling in a 'dev-master' version, which was causing the issue. As soon as I changed to a more stable (actual) version it deployed with no issues.

domioanna started a new conversation Deployment Failing: Composer\Util\Filesystem::$filesystem

When I deploy through composer I get the following message during the Install Composer Dependencies section...

  - Installing swiftmailer/swiftmailer (v5.4.1)
    Loading from cache

  - Installing jakub-onderka/php-console-color (0.1)
    Loading from cache

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Loading from cache

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Loading from cache

  - Installing psy/psysh (v0.5.2)
    Loading from cache
                                                             
  [ErrorException]                                           
  Undefined property: Composer\Util\Filesystem::$filesystem  
                                                             
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [packages1] ... [packagesN]

Any ideas, or know how to fix it?

15 Oct
3 years ago

domioanna left a reply on Eloquent Query To 'merge' / 'join' / 'union' 2 Related Tables

Built a transformed, worked perfectly! Cheers @pmall

domioanna started a new conversation Eloquent Query To 'merge' / 'join' / 'union' 2 Related Tables

Let's say I had 2 tables, linked by a one-to-many relationship.

  • Post - belongsTo a user
  • User - hasMany posts

I know I could set up the relationships and call a post with it's owner like so...

$post = Post::with('owner')->first();

...but this returns a collection of the post with the user nested inside of it, like this:-

[
    'id' => 1,
    'user_id => 1,
    'title' => "Some title...",
    'body' => "Some body...",
    'owner' => [
        'id' => 1,
        'username' => "johndoe",
        'email" => "john@example.com"
    ]
]

Is there a way to effectively 'join' or 'merge' those 2 sets of data into one record, so it would look like this...

[
    'id' => 1,
    'title' => "Some title...",
    'body' => "Some body...",
    'username' => "johndoe",
    'email" => "john@example.com"
]

I know there'd be conflicting fields like id, created_at, etc, I would only look to pull across certain fields.

I know this concept is a bit of a backwards way of doing it for this scenario, but for the actual scenario I need it for it will save me a lot of trouble.

Thanks in advance

14 Oct
3 years ago

domioanna started a new conversation Larval 5.1 And SSL

Who do you all use for SSL Certificates, and are there any resources out there that explain how to install them on Laravel, through Forge, hosting with DigitalOcean?

domioanna started a new conversation Amazon S3 Vs Rackspace Vs Local Storage

I'm building a project that is going to allow users to upload images to records, and I'm looking at 'future-proofing' the site, and I was wondering which people have experience with and which they would recommend in terms of pricing, usability, reliability, etc...

The project will be hosted on DigitalOcean, through Forge, so 'local' storage will be on that hosting package.

06 Oct
3 years ago
04 Oct
3 years ago

domioanna left a reply on Updating Elixir To 3.3, Error When Running Gulp

Fixed: upgraded out of date Node / npm

All working. Normal service is now resumed.

Thanks guys.

domioanna left a reply on Updating Elixir To 3.3, Error When Running Gulp

I've tried that too @ejdelmonico but for some reason it just wont play on mine at all. I wonder if upgrading to El Capitan has had anything to do with it as if has the same issue when I install a brand new Laravel app...

03 Oct
3 years ago

domioanna left a reply on Updating Elixir To 3.3, Error When Running Gulp

I just uninstall all instances of Laravel Elixir, then installed it, whilst watching the node_module/laravel-elixir folder...

It created all the files for Laravel Elixir, then created a node_modules folder, then proceeded to delete all the other files in laravel-elixir folder except the node_modules folder

domioanna left a reply on Updating Elixir To 3.3, Error When Running Gulp

Nope, that doesn't work, and now I can't install an earlier version of Laravel Elixir, it just resorts to try install the latest version which dumps out a whole string of errors when trying to install...

domioanna started a new conversation Updating To 3.3, Error When Running Gulp

After updating package.json to pull in the latest release of Elixir (3.3.1) and running npm install to update, now whenever I run gulp I get the following error

Error: Cannot find module 'laravel-elixir'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/domioanna/Code/spark-test/gulpfile.js:1:76)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Any ideas?

27 Jun
3 years ago

domioanna left a reply on Don't Allow User To Change Others Posts

If you've set up your relationships you can use something like the following

    $this->user = Auth:user();
$post = $this->user->posts()->findOfFail($post_id);

$post->update( ... array of changes ... );

domioanna started a new conversation Create JSON Key And Value From 2 Form Fields

I'm utilising the JSON field type in Laravel, but I'm trying to allow the user to fill in a form whereby there would be a row of 2 input fields, whatever they enter in the first field will become the key and the second field would become the value, creating a key => value pair, saving to the database in a JSON format.

Then if the user wants to add another row, they would click a button to add another row.

I don't suppose anyone has any ideas on how I could achieve this?

Using Laravel 5.1, along with Illuminate's HTML / Form facade. Also utilising jQuery if that offers up any solutions.

13 May
3 years ago

domioanna left a reply on Using ->with() With Constraints, Issue With 'HAVING'

Thanks @Kryptonit3, @dazzz1er and @JarekTkaczyk!

Each of your comments helped me solve the problem. In the end, I liked the idea of a 'scope' as suggested by @StormShadow, as this give me a nice, simple method to add onto a string of an eloquent call and it works fine.

12 May
3 years ago

domioanna started a new conversation Using ->with() With Constraints, Issue With 'HAVING'

This code...

public function getStrategiesWithinDistance($strategy, $postcode, $distance)
    {
        $coords = Postcode::getCoordinates($postcode);
        $lat = $coords['latitude'];
        $lng = $coords['longitude'];

        return $this->user->$strategy()->with([
            'property' => function ($query) use ($lat, $lng, $distance) {
                $query
                    ->selectRaw(
                    '( 3959 * acos(
                            cos( radians( '.$lat.' ))
                            * cos( radians(latitude ) )
                            * cos( radians(longitude ) - radians( '.$lng.' ) )
                            + sin( radians('.$lat.') )
                            * sin( radians( latitude ) )
                        ))
                        AS distance')
                    ->having('distance', '<', $distance)
                    ->select('*');
            }
        ])->get();
    }

...is causing this error...

Illuminate \ Database \ QueryException (42S22)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'distance' in 'having clause' (SQL: select * from `properties` where `properties`.`deleted_at` is null and `properties`.`id` in (5, 6, 1, 2) having `distance` < 5)

Has anyone attempted to incorporate something like this and succeeded or can anyone see what could be the problem?

As you can probably see from my recent posts, this is something I'm REALLY struggling with.

11 May
3 years ago

domioanna started a new conversation Incorporating A Eloquent Raw Query Into A Chained Query

I have a raw query, as follows:-

$results = DB::select(
            DB::raw(
                'SELECT *, ( 3959 * acos( 
                    cos( 
                        radians(' . $lat . ') 
                    ) * cos( 
                        radians( latitude )
                    ) * cos( 
                        radians( longitude ) - radians(
                            ' . $lng . '
                        )
                    ) + sin( 
                        radians(
                            ' . $lat .'
                        )
                    ) * sin( 
                        radians(
                            latitude
                        )
                    )
                ) 
            )
            AS distance FROM properties HAVING distance < ' . $distance . ' ORDER BY distance') );

        return $results;

...which works find for getting ALL properties, but I need to get all of the logged in users properties AND apply a where clause onto a joined table 'strategies'.

Any ideas?

06 May
3 years ago

domioanna started a new conversation Count On A Polymorphic Relationship With Criteria

Say I have a Strategy table which has a polymorphic relationship with 3 other tables of Strategy 1, Strategy 2 and Strategy 3.

I need to count how many records there are in just one of the linked tables (i.e. Strategy 2) that match a criteria, i.e. the value of a field is > 150.

I really can't get my head around how to do it.

Any ideas?

Just to give an idea of the relationships...

User HAS MANY Strategies

Strategies HAVE MANY "sub" strategies.

30 Apr
3 years ago

domioanna left a reply on Traits And Dependency Injection

@MarkRedeman After spending a good while on this last night I turned off my Mac, went to sleep. Then in the middle of the night I woke up with the thought of doing it EXACTLY how you've written it! Haha!

So I'll implement that tonight. Thank you.

29 Apr
3 years ago

domioanna left a reply on Traits And Dependency Injection

OK, I've changed it to a Controller extending a BaseController, so the idea is that there'll now be several StrategyControllers that extend the BaseController, but the store() and update() methods on each will need different Request files to be injected into them.

Any ideas how I could achieve this?

domioanna left a reply on Traits And Dependency Injection

I have a StrategyTrait file which looks like this

trait StrategyTrait {

    protected $name;
    protected $repository;
    protected $createCommand;
    protected $strategyRequest;

    /**
     * Store a newly created resource in storage.
     *
     * @return Response
     */
    public function store(Request $request)
    {
        $this->dispatchFrom(
            $this->getCreateCommand(), $request
        );

        Flash::success('Awesome! You added a new strategy.');

        return redirect('property/' . $request()->get('property_id'));
    }
}

I'm trying to set it so that I can change which Request file is called for validation by defining it in that particular Strategy controller, so for example (I've been using __constructor() to set these, but if you know of a better way, say)...

class SingleletController extends Controller
{
    use StrategyTrait;

    protected $strategyRepository;

    public function __construct(StrategyRepository $strategyRepository)
    {
        parent::__construct();
        $this->middleware('auth');

        $this->setStrategyName('singlelet');
        $this->setRepository($strategyRepository);
        $this->setCreateCommand(CreateSingleletCommand::class);
    }
}

For the Repository and Command it works

domioanna started a new conversation Traits And Dependency Injection

So, because I've got several Controllers that use the same methods and each of those methods are more or less exact other than a couple of variables on each Controller, I've created a trait and set up getters and setters for each of these variables which are called and set in the __construct() of each Controller.

Now, my question... How do I set the 'Request $request' dependency injection on a method? Each Controller will need it's own request calling but I cannot work out how inject it...

public function store(Request $request)
{
    // Do something amazing...
}