aurawindsurfing

aurawindsurfing

Laravel Newbie at @

Member Since 2 Years Ago

Dublin, Ireland

Experience Points
186,600
Total
Experience

3,400 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
962
Lessons
Completed
Best Reply Awards
124
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 38
186,600 XP
Nov
19
5 hours ago
Activity icon

Replied to How Can I Connect Laravel With Ms Access ?

Hey @arsalan34

Hope this points you in the right direction:

Create link in MS Access with your MySql database table and now both databases have same data every time.

Procedure for link MySql table in MS Access database. https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html

Activity icon

Replied to Getting The Width And Height From Upload Value

Try:

img.onload = function () {console.log(this.width)}

Hope it helps!

Activity icon

Replied to How To Set Up WordPress With Forge When Using An AWS RDS Database?

Hey @ralphmrivera

Just create an empty site with forge on your server. Then SSH to it and install wordpress:

wget https://wordpress.org/latest.tar.gz
Then unzip the package using:
tar -xzvf latest.tar.gz

https://wordpress.org/support/article/how-to-install-wordpress/

Then change IP od your MySQL server to RDS one.

I still do not understand WHY 😀

Activity icon

Replied to Add Unique License To APP

Ioncube will be probably the only option.

But to be honest look at how whole Laravel ecosystem works. The private repo seems to be the most popular way. Maybe you are overthinking it a bit?

On the other hand you could also build your app in a way that client needs internet connection to authorise with some sort of your API.

Nov
18
1 day ago
Activity icon

Replied to Changing Logout Redirect Path In Laravel Nova

Hey @elo

I'm pretty sure Nova has nothing to do with your Passport check the basic .env file in your app. Did you change:

APP_URL=http://localhost

to the name of your app?

Activity icon

Replied to Add Unique License To APP

Hey @kboat14

You can sell subscription and deactivate user account when it expires.

If you give your code to clients then you can distribute your app as a private repository, just like Laravel Nova.

There is also thing called https://www.ioncube.com/loaders.php it allows you to encrypt some of the files in your php application. I have seen some people using it.

To be honest private repo is probably the easiest.

Hope it helps!

Activity icon

Replied to Eloquent Load Only Related Deep Relation

Hi @constantinff

Try to reverse your query.

What you try to do at the end of the day is to get subscriptions that have users that in turn have groups.

This might be used https://laravel.com/docs/master/eloquent-relationships#has-one-through or if there are keys on those tables simple BelongsTo should do the trick.

Nov
17
2 days ago
Activity icon

Replied to Best Practice To Avoid Three Almos Identical Controllers?

No it does not. It has methods that you use like normal. While you extend it you have access to it's methods.

Have a look here: https://stackoverflow.com/questions/5199862/php-class-inheritance-for-beginners

Hope this helps!

Nov
16
3 days ago
Activity icon

Replied to Merging Request Params With Array

Hi @gabotronix

Fro your code:

 public function filters()
    {
        //returns associative array of request body key value pairs
        return $this->request->all();
    }

Return an array and then you try to use collection merge method on it:

$filters->merge($toMerge);

This is not a collection, this is an array, try:

$result = array_merge($filters, $toMerge)

Hope it helps!

Nov
13
6 days ago
Activity icon

Replied to Convert Objects Of Arrays In Laravel

$prepared_products = $order->productwarehouses()->with('product')->get()->groupBy('product.id')->toArray();

toArray also converts all of the collection's nested objects that are an instance of Arrayable to an array. If you want to get the raw underlying array, use the all method instead.

Activity icon

Replied to Best Practice To Avoid Three Almos Identical Controllers?

Hey @rafaelmunoznl

Yes you can create lets say XController in that controller try to divide the show function into smaller functions.

The in your CompaniesController use extend like this:

class CompaniesController extends XController {

}

Now what that will allow you to do is to use all of the original methods of XController and if one needs to be changed then you just redeclare it again.

This will simplify your code a lot.

Hope it helps!

Activity icon

Replied to Laravel File_put_contents(..../session/....) Failed To Open Stream

Hey @seventopo

Save yourself some time and get a proper hosting that will let you understand your errors while accessing the console.

This issue is probably related to permissions and some folders not being set up properly.

Long story short. Click on one of the ads from Digital Ocean here is a my referral link that will give you 50e https://m.do.co/c/27a7fce72833

Then register also Laravel Forge to easily provision (install) your servers with MySQL, PHP, Nginx etc.

Then sib back and relax ;-)

Activity icon

Replied to Googlebot Cannot Access Images Hosted On CloudFront - Reports Blocked By Robots.txt

Hey @thebigk

I would look then at AWS policies, maybe bots are excluded in there from accessing the files and you can only access it from your application?

Hope it helps!

Nov
10
1 week ago
Activity icon

Replied to Googlebot Cannot Access Images Hosted On CloudFront - Reports Blocked By Robots.txt

Hey @thebigk

This might be long shot but is there a way to sitemap your images and give it to google that way?

Here is some info I found: https://support.google.com/webmasters/answer/178636?hl=en

Activity icon

Replied to Make An Appointment System

@hafizurupm it is the right place to learn how to make such a system for sure.

Start from https://laracasts.com/series/laravel-6-from-scratch

This will give you a good idea where you should start.

Nov
09
1 week ago
Activity icon

Replied to Comparing Services For Cheap Cloud Hosting And Storage (Cloud / AWS / S3 / Amazon Cloudfront / ... ???)

Hey @connecteev

AWS <> as close to free as possible
as fast as possible <> as close to free as possible

If you want something free and really well thought then go and try https://www.netlify.com/ this might serve your goal with few tweaks.

Hope it helps!

Nov
07
1 week ago
Activity icon

Replied to Remote Model

Hey @poxin

Trucker looks more like for mapping resources. What you need it to possibly Cache your responses from API to have some sort of safety on your side when API will be down. This way you will have old data to work with or by setting expiry on Cache you will actually limit your API queries.

Just an idea.

Hope it helps!

Activity icon

Replied to Dealing With Git - Main Package And Subpackages

Why not do simple bash script for your project?

https://laravel-news.com/bash-aliases

Have it chained in one command and commit all of them at once, maybe even detect if there was a change and and only then commit that submodule?

Hope it helps!

Nov
04
2 weeks ago
Activity icon

Awarded Best Reply on Oci8 Exception - Laravel On Centos 7

Hi @konrms

I have a similar setup working. Some points from my notes that might help you troubleshoot.

Did you add

extension=oci8.so

to your php-fpm.ini?

check if it is installed:

php -m | grep oci

or

<?php phpinfo(); ?>
i
print_r(get_loaded_extensions());

test connection from your app:

$conn = oci_connect("USER", "passwprd", "localhost/xe");
 echo $conn;

Only here install yajra

Hope it helps!

Nov
02
2 weeks ago
Activity icon

Replied to Proper Way To Run Laravel Queue In Docker

Hey @region23

This solution does not run your Queue Worker in docker. It runs a command from outside of your docker container to run in a docker container called php

I stopped working with docker but the idea will be to run this command from within the container and actually build it with it already set up. Go back to the thread you are referencing and you will see that you answer is voted -3

https://stackoverflow.com/questions/48884802/docker-laravel-queuework

Go for one of the accepted solutions.

Hope it helps!

Activity icon

Replied to Oci8 Exception - Laravel On Centos 7

No worries! Oracle Magic!

Activity icon

Replied to Oci8 Exception - Laravel On Centos 7

Hi @konrms

I have a similar setup working. Some points from my notes that might help you troubleshoot.

Did you add

extension=oci8.so

to your php-fpm.ini?

check if it is installed:

php -m | grep oci

or

<?php phpinfo(); ?>
i
print_r(get_loaded_extensions());

test connection from your app:

$conn = oci_connect("USER", "passwprd", "localhost/xe");
 echo $conn;

Only here install yajra

Hope it helps!

Activity icon

Replied to How To Make Laravel Load Very Fast

Is this a question or a statement? 😃

Activity icon

Awarded Best Reply on Limit The User Login To Specific Time Period

@itxrahulsingh read the docs carefully.

The way this works is that request to your app will hit every middleware each time you ask for anything. This is how login of users works. Here, for example, you have default middleware that is already in use in your app:

protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

So before anything happends in your app it already check for:

  • cookies
  • sessions
  • authenticated sesssions
  • errors in session
  • csrf token

So it already checks if user is logged in. You only need to add another one that will let users log in only within working hours.

It will always work for every request to your app.

Hope it helps!

Activity icon

Replied to How To Query Database For Each Day In An Array Of Days Laravel

Hey @farshadf

Modify it to your needs but something like that will do the trick:

$room_capacity = Capacity::query()
            ->whereBetween('date', [
                Carbon::now()->startOfMonth()->subMonth()->toDateString(),
                Carbon::now()->startOfMonth()->subMonth()->endOfMonth()->toDateString(),
            ])
            ->get();

This here makes no sense:

->whereDate('from_date', '<=', $dates[$t])

It actually should be:

->where('date', '<=', $dates[$t])

Also if you try to do a booking system then try to think in a smallest possible interval when you think about your reservations. For instance if room can only be booked for 1 day, then instead of creating from_date to_date you could create 31 days in a given month and then create lets say 4 consecutive bookings for one day for that room - meaning it would be booked for 4 days.

This type of approach will make your system more flexible and easier to work with.

You can even go down to hours and book rooms per hours. Even go down to minutes etc etc. Your future queries would be much simpler then as well.

Hope it helps!

Activity icon

Replied to Limit The User Login To Specific Time Period

@itxrahulsingh read the docs carefully.

The way this works is that request to your app will hit every middleware each time you ask for anything. This is how login of users works. Here, for example, you have default middleware that is already in use in your app:

protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

So before anything happends in your app it already check for:

  • cookies
  • sessions
  • authenticated sesssions
  • errors in session
  • csrf token

So it already checks if user is logged in. You only need to add another one that will let users log in only within working hours.

It will always work for every request to your app.

Hope it helps!

Activity icon

Awarded Best Reply on Laravel Delete Relationships On A Single Model?

Hi @zyxxyzyxz

Have a look here: https://laravel.com/docs/master/eloquent-relationships#updating-belongs-to-relationships

There are quite a few that you could use like

$user->account()->associate($account);
$user->account()->dissociate();

$user->save();

There is also one for pivots

// Detach a single role from the user...
$user->roles()->detach($roleId);

// Detach all roles from the user...
$user->roles()->detach();

Hope it helps!

Activity icon

Replied to Laravel Delete Relationships On A Single Model?

Hi @zyxxyzyxz

Have a look here: https://laravel.com/docs/master/eloquent-relationships#updating-belongs-to-relationships

There are quite a few that you could use like

$user->account()->associate($account);
$user->account()->dissociate();

$user->save();

There is also one for pivots

// Detach a single role from the user...
$user->roles()->detach($roleId);

// Detach all roles from the user...
$user->roles()->detach();

Hope it helps!

Activity icon

Replied to A Problem In Blade When Uses Eloquent

Hey @shirotzumiyake

@foreach ($reactions as $reaction)

Inside this loop you should call $reaction and not $react

Also try to move your logic to Controller that displays this blade. There should suppose to be as little logic in your views as possible.

Hope it helps!

Activity icon

Replied to User Auth From Mobile App

Hey @muazzamazaz

The simple answer "you can not".

While you access your app not from a browser then there is no cookies, no session etc.

What you need is JWT, have a look here: https://laravel.com/docs/5.8/passport

In a nutshell, you need to authorise every request that will hit your app's API.

Hope it helps!

Activity icon

Replied to How To Re-construct A Class In Single Process?

Hey @muzafferdede

It could be a bit long shot but did you consider using tap() when you look at the docs this helper looks somewhat underrated:

https://laravel.com/docs/master/helpers#method-tap

but if you look at how Taylor is using it: https://medium.com/@taylorotwell/tap-tap-tap-1fc6fc1f93a6

It makes all the difference! I bet you can use it for your Class as well.

Hope it helps!

Activity icon

Replied to Limit The User Login To Specific Time Period

@itxrahulsingh create additional middleware that check for office hours.

Check the docs here: https://laravel.com/docs/master/middleware#defining-middleware

Hope it helps!

Nov
01
2 weeks ago
Activity icon

Replied to Group-by Not Working With Order By Laravel Elequent

@farshadf I guess you need to go for a long long walk and look at it from distance.

You have quite experienced guys trying to help you here. I think you might be to fix on your way of doing things.

If you are trying to solve something with a monster query then it means that your whole app needs to be redesigned as it does not suit your purpose. Look at putting some of this directly on models that are involved. Then from use those models to simplify your controllers then break you query into smaller queries or query scopes etc etc.

Monster Queries are bad!

Happy Coding!

Oct
30
2 weeks ago
Activity icon

Replied to Group-by Not Working With Order By Laravel Elequent

@farshadf are you able to write the same query in MySQL IDE and get expected results? Maybe try this first and make sure your query works on MySQL level?

Activity icon

Replied to Group-by Not Working With Order By Laravel Elequent

Then he should run his method on results of groupBy it returns completely new set of records, this is why orderBy does not work I think.

Activity icon

Replied to Group-by Not Working With Order By Laravel Elequent

Hey @farshadf

Use sortBy instead of orderBy

Oct
29
3 weeks ago
Activity icon

Awarded Best Reply on Add If Condition In Controller?

Hey @andreixfr

public function edit($id)
    {
        $model = Models::with('model_media')->findOrFail($id);
        if(!isset($model->sort)){
        $data['allMedia'] = ModelMedia::where([["model_id", "=", $id]])->orderBy('sort')->get();
      }else{
        $data['allMedia'] = ModelMedia::where([["model_id", "=", $id]])->orderBy('sort', 'DESC')->get();
      }

Hope it helps!

Activity icon

Replied to Add If Condition In Controller?

Hey @andreixfr

public function edit($id)
    {
        $model = Models::with('model_media')->findOrFail($id);
        if(!isset($model->sort)){
        $data['allMedia'] = ModelMedia::where([["model_id", "=", $id]])->orderBy('sort')->get();
      }else{
        $data['allMedia'] = ModelMedia::where([["model_id", "=", $id]])->orderBy('sort', 'DESC')->get();
      }

Hope it helps!

Oct
26
3 weeks ago
Activity icon

Replied to Get Count In Multilple Models

Hi @untymage

Your code finds only 1 artist. It does not look for usages of tag pop

$artist = Artist::withCount('tags')->find($id);

$artist->tags_count;

Try:

$artist->albums->where('tags', 'like', '%' . 'pop' . '%')->count()

Hope it helps!

Activity icon

Replied to Mailgun

You add guzzle with composer.

You push to the server only composer.json

Server installs it while deploying your code or you install it by hand by running

composer install

on your server.

What are you using for deployement of your code?

Oct
25
3 weeks ago
Activity icon

Replied to Valet+ And Catalina

Hey @finchy70

First get a regular valet to work. Remove everything associated with valet and reinstall it completely.

It is questionable why Catalina should have anything to do with valet not working. It could be a simple restart of the machine that caused some changes to kick in that you have introduced yourself few weeks before.

Does valet start at all? What does it say when it starts?

What can you see when you run:

valet paths
valet links
Activity icon

Replied to How Can I Load Collection Data Into A Table?

Hi @myke2424

Something like that should do the trick for a start:

{{$months = collect(['Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec'])}}

<table class="table table-striped table-sm">
    <thead>
    <tr>
        <th scope="col">Month</th>
        <th scope="col">Overtime Hours</th>
        <th scope="col">Compensation Hours</th>
        <th scope="col">Vacation</th>
        <th scope="col">Personal Hours</th>
        <th scope="col">Sick Hours</th>
    </tr>
    </thead>
    <tbody>
    @foreach ($months as $month)
        <tr>
            <th scope="row">{{$month}}</th>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td>
        </tr>
    @endforeach
    </tbody>
</table>
Oct
10
1 month ago
Activity icon

Replied to Download PDF In Laravel Nova Action

@kidereo to download the file you need to send it to your browser as a response. Similar to what you do to send your browser to a view.

When you click something, just return from your controller Storage::download() that should do the trick.

Remember that you can download only one file that way.

Hope it helps!

Oct
06
1 month ago
Sep
25
1 month ago
Activity icon

Replied to How To Set Time Between Reports Of Users?

Hi @andreixfr

Enable button if:

$last_report = $user->reports->latest()->first()->get();
if ($last_report->created_at < Carbon::now()->subMinutes(5)->toDateTimeString()) {
// show modal button
}
Activity icon

Replied to Laravel Cashier - Undefined Variable: Token

@wallyj

When you installed laravel did you install the latest version? Version 6.0.x does not support Braintree as far as I'm aware:

https://laravel.com/docs/6.x/braintree

but 5.8 does:

https://laravel.com/docs/5.8/braintree

Check version of your Cashier as well. I think this is the highest that supports Brainthree but I could be wrong: https://github.com/laravel/cashier/releases/tag/v9.3.5

Hope it helps!

Sep
22
1 month ago
Activity icon

Replied to JWT TOKEN WEB APP

Hey @gustavocassoto

You can pass token in the header of your http request as well.

Activity icon

Replied to Don't Touch!

Hey @arketekt

Yes this is exactly the way you should do this:

php artisan vendor:publish

The overwrite anything you like in resources/views In those views there should be references to the styling files so you might just want to write your own styles and drop the basic ones.

Hope it helps!