fsdolphin

fsdolphin

Member Since 4 Years Ago

Experience Points 20,345
Experience Level 5

4,655 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 185
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

12 Nov
5 months ago

fsdolphin left a reply on Limit HTTP Requests For Users Only

@JLRDW - There is no sensitive data, I'm just worry about bots making random requests to overwhelm the server or something like that.

fsdolphin left a reply on Limit HTTP Requests For Users Only

@JLRDW - Thank you for your reply.

Can you please clarify one thing, if I go with Laravel Authentication the user would need to first create an account, correct?

Do you see a problem if I just make GET request without any Authentication (as is right now)?

fsdolphin started a new conversation Limit HTTP Requests For Users Only

Hi,

I currently have a simple Laravel app, one of the things it does is, it provides some information based on a ZipCode. I will be accessing this information from a Mobile app, in other words, the user will input their zip code in the mobile app and the Laravel app will return the information that corresponds to that zip code.

Heres my code...

Route:

Route::get('zip-code/{zipCode}', '[email protected]');

Controller:

class AppsAPIController extends Controller
{
        public function information($zipCode)
        {     
            $info = CityInfo::where('ZipCode', $zipCode)->get();
            return ($info);
        }
}

Everything is working fine, I just have the following question...

Is there a way to limit the HTTP requests to only the users using the mobile app? In other words is there a way to somehow link the HTTP request to some sort of number in the mobile app and only respond when the request contains that number.

The only reason I want to implement this functionality is honestly because I'm not sure if leaving the HTTP request open to the public could cause any issues.

02 Apr
2 years ago

fsdolphin left a reply on Laravel Mix Keeps Compiling Every Second Without Stop After `npm Run Watch`

Thanks a lot @isatrio.

Solution from @jacurtis

Change...

mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');

to...

mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.options({processCssUrls: false
});

Thanks a lot @jacurtis

01 Apr
2 years ago

fsdolphin left a reply on Understanding How Permissions Are Set In A Fresh Installation

If I'm not mistaken the default permission are set based on the permissions of the user who owns the files and folders.

31 Mar
2 years ago

fsdolphin started a new conversation Understanding How Permissions Are Set In A Fresh Installation

Hi,

It is my understanding that in Laravel most folders should be normal 755 and files, 644 but can someone explain me why in a fresh install my folders are set to 775 and files to 664?

What dictates the default permissions in a server?

Here is what I see in a fresh install...

drwxrwxr-x 6 groupName userName 4096 Mar 31 15:40 app -rw-rw-r-- 1 groupName userName 1646 Mar 31 15:40 artisan drwxrwxr-x 3 groupName userName 4096 Mar 31 15:40 bootstrap -rw-rw-r-- 1 groupName userName 1300 Mar 31 15:40 composer.json -rw-rw-r-- 1 groupName userName 121424 Mar 31 15:40 composer.lock drwxrwxr-x 2 groupName userName 4096 Mar 31 15:40 config drwxrwxr-x 5 groupName userName 4096 Mar 31 15:40 database -rw-rw-r-- 1 groupName userName 1062 Mar 31 15:40 package.json -rw-rw-r-- 1 groupName userName 1055 Mar 31 15:40 phpunit.xml drwxrwxr-x 4 groupName userName 4096 Mar 31 15:40 public -rw-rw-r-- 1 groupName userName 3424 Mar 31 15:40 readme.md drwxrwxr-x 5 groupName userName 4096 Mar 31 15:40 resources drwxrwxr-x 2 groupName userName 4096 Mar 31 15:40 routes -rw-rw-r-- 1 groupName userName 563 Mar 31 15:40 server.php drwxrwxr-x 5 groupName userName 4096 Mar 31 15:40 storage drwxrwxr-x 4 groupName userName 4096 Mar 31 15:40 tests drwxrwxr-x 31 groupName userName 4096 Mar 31 15:40 vendor -rw-rw-r-- 1 groupName userName 555 Mar 31 15:40 webpack.mix.js -rw-rw-r-- 1 groupName userName 204990 Mar 31 15:40 yarn.lock

Is this the common default permissions in a fresh install?

26 Mar
2 years ago

fsdolphin started a new conversation Laravel Mix Keeps Compiling Every Second Without Stop After `npm Run Watch`

Any idea why Laravel Mix keeps compiling when I npm run watch without stopping?

This is what I see...

The notifications is on all the time with the following message

terminal-notifier 1,297 new notifications

When I save my SCSS the notifications resets to 0 and keeps going.

In the terminal I see a flashing message that changes between

WAIT Compiling...

and

DONE Compiled Successfully in 266ms

FYI - It compiles fine and no errors, it just doesn't stop and it's annoying.

24 Mar
2 years ago

fsdolphin left a reply on Understanding The Move And The StoreAs Methods For Saving/uploading Files To The Filesystem

I tried your code and it saves to the storage folder.

Route::post('routeName', function($request) {
        $file = $request->file('fieldName');
        $file->storePublicly('images');
});

fsdolphin left a reply on Understanding The Move And The StoreAs Methods For Saving/uploading Files To The Filesystem

I also watched that video but for some reason I couldn't make it to save to the public directory so I assumed it was a helper for private uploads since it saves to the storage folder by default.

Quick question, do you how can I make it to save to the public directory? I rather use this method.

Route::post('routeName', function(){
    request()->file('fieldName')->store('public/images');
    return back();
});

https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/12

fsdolphin left a reply on Understanding The Move And The StoreAs Methods For Saving/uploading Files To The Filesystem

@trcraig On your comment about the move method, that is part of my confusion why use this method when first uploading files. In fact Jeffrey uses the move method in the following two videos...

Min: 7:50 https://laracasts.com/lessons/file-uploads-101

Min: 18:3 https://laracasts.com/series/build-project-flyer-with-me/episodes/11

fsdolphin started a new conversation Understanding The Move And The StoreAs Methods For Saving/uploading Files To The Filesystem

This is my first time uploading files and I have been watching videos and some online tutorials and I noticed that there are a few ways to do the upload which is a little overwhelming by not understanding the use cases.

I have seen people using the move() method, some others use the storeAs() method, some others using Storage::disk() and some other using request()->file()->store(), anyways for now I would like to focus on the move() and the storeAs() methods.

Can someone give me a quick explanation on when would you use one over the other?

Illuminate/Http/UploadedFile

storeAs()

Store the uploaded file on a filesystem disk.

Illuminate/Filesystem/Filesystem

move()

Move a file to a new location.

fsdolphin left a reply on Uploading Images To The `public` Directory Stops Working After The First Image Is Uploaded

@Snapey Could you please elaborate a little bit more on why it was redirected to the images folder instead of responding to the POST request the second time?

Is this a normal behavior with http requests where by default if a folder with the same name as the request is found the 'POST' request will be ignored, meaning that folders have precedence?

I know this is not related to my issue but I would like to have a better understanding. Thanks a lot.

fsdolphin left a reply on Uploading Images To The `public` Directory Stops Working After The First Image Is Uploaded

@Snapey, you are right, I changed the folder name and it now works. Thanks a lot for your help.

$file->move(public_path().'/pictures/', $fileName);
23 Mar
2 years ago

fsdolphin left a reply on Uploading Images To The `public` Directory Stops Working After The First Image Is Uploaded

Yes, I'm trying to upload a different image the second time but I keep getting the error. I just confirmed it and still got the error.

fsdolphin started a new conversation Uploading Images To The `public` Directory - It Works Only One Time

I'm trying to upload images to the publicfolder but for some reason it only works the first time I run my code, in other words as soon as the images folder is created inside the public directory it stops working and I get a Not Found message. The first image is uploaded and saved to the database, but again, it only works one time and if I delete the images folder it works again for another image and then stops working again.

Message

Not Found: The requested resource /images was not found on this server.

Here is the code I have...

Routes:

Route::post('images', '[email protected]');

Controller:

class ImageController extends Controller{
        public function store(){
            $file = request()->file('image');
            $fileName = str_replace(' ','', $file->getClientOriginalName());
            $file->move(public_path().'/images/', $fileName);

            // Save to database
            $image = new \App\Image();
            $image->imageName = $fileName;
            $image->save();

            return back();
        }
}

Form:

<body>

    <form method="POST" action="images" enctype="multipart/form-data">

        {{ csrf_field() }}

        <input type="file" name="image">

        <button type="submit">Save</button>

    </form>

</body>

The funny thing is that if I change the following line of code to upload to the storage directory it works fine, but of course I want to upload to the public directory.

If I change...

$file->move(public_path().'/images/', $fileName);

to

$file->storeAs('images/', $fileName);

It works fine.

What am I doing wrong?

fsdolphin left a reply on When To Save URL Images In A Database Vs When The File-system Is Enough

@martinbean One last question, does it matter where do I put my images, in the storage folder or the public folder? Is there a common practice?

fsdolphin started a new conversation How Can I Remove Empty Spaces Form A File Name When Uploading To The Server

Hi,

How can I remove empty spaces form a file name when uploading to the server?

Here is the code I'm currently using which grabs the file's original name and saves it into hard disc (storage/app/images).

$file = request()->file('imageFile');
$fileName =  $file->getClientOriginalName();
$file->storeAs('images/', $fileName);

I know I could use the following code which automatically generates a hash name but I need to capture the name to be able to save it in a database and I'm not sure if using this method would be possible to get the auto generated hash name.

request()->file('imageFile')->store('images');

Again, how can I remove any empty space form a file?

For instance, change my file name.jpg to myfilename.jpg

Thanks

fsdolphin left a reply on When To Save URL Images In A Database Vs When The File-system Is Enough

@martinbean Is that generally the process you follow, regardless of what type of app you are building?

fsdolphin started a new conversation When To Save URL Images In A Database Vs When The File-system Is Enough

Hi,

What is the best way to manage images in the following situation…

I have a real simple CMS-like- app where images will be uploaded and stored in either the default storage or the public directory and then accessed in any part of the authenticated areas of the app. For instance the user will have the option to insert any of the uploaded images from/to any of the pages by inserting the URL of the selected image (using an inline HTML editor ).

  1. Do I need to save the URLs of the images in a database or saving them in a directory and then just retrieving the file names directly from the directory would be enough?

  2. Can someone describe a situation when It’s recommended to use a database and when to use the file system directly?

Thanks a lot

16 Mar
2 years ago

fsdolphin started a new conversation Understanding The Assets

I would like to have a better understanding on the default assets on a fresh Laravel installation.

Here are my silly questions...

  1. In a fresh Laravel 5.4 installation, why does the public/css/app.css contains code if Laravel Mix hasn't run yet?

  2. Why does the same import for the fonts exists in both the .css and .scss, shouldn't the one in the .scss enough?

  3. Couldn't the normalize be an import in the .scss instead?

I was expecting to see imports in the resources/assets/sass/app.scss file but nothing in the public/css/app.css until you run mix.

Can someone elaborate a little bit on this? I'm just trying to understand the purpose of this code structure.

Thanks a lot.

13 Mar
2 years ago

fsdolphin left a reply on Understanding The IoC Container

It's starting to make more sense. Thanks.

08 Mar
2 years ago

fsdolphin started a new conversation Understanding The IoC Container

Hi,

I'm trying to have a better understanding on how the IoC container works and what are the benefits of using it. The lack of understanding these concepts it's stopping me from creating more complex projects and learn more advance concepts.

How would the following code benefit from using the IoC container?

class Car
{
    private $color;
    private $engine;

    public function __construct(Color $color, Engine $engine)
        {
            $this->color = $color;
            $this->engine = $engine;
        }

        public function makeCar()
        {
            // creating car...
         }
}

$jetta =  new Car(red, 2.5);

$jetta->makeCar();

If the code above is not sufficient for demonstrating the power of using IoC container, could someone create an example using plain PHP vs using the IoC container?

Thanks a lot!

08 Nov
2 years ago

fsdolphin left a reply on Understanding URLs And Mage Links

@Repox Thanks a lot for the clarification.

fsdolphin left a reply on Understanding URLs And Mage Links

@bobbybouwmann / @Repox Both examples worked, now the question is, is there any benefit when using one over the other?

<img src="/images/my-image.png" alt="">

VS

<img src="{{ url('images/my-image.png') }}" alt="">

fsdolphin started a new conversation Understanding URLs And Mage Links

This is a very basic question. Why does the route/URL affects the location of an image?

This works fine...

Route:

Route::get('apps', function () {
    return view('apps');
});

View:

resources > views > apps.blade.php

    <img src="images/my-image.png" alt="">

This does NOT work...

Route::get('apps/appName', function () {
 return view('appName');
});

View:

resources > views > appName.blade.php

    <img src="images/my-image.png" alt="">
20 Oct
2 years ago

fsdolphin left a reply on Npm Error

I also tried

    sudo npm install -g [email protected]

And I get the following which doesn't look like an error nor a fix.

/usr/lib └── [email protected]

fsdolphin started a new conversation Npm Error

I'm trying to user Elixir in a bran new Laravel project but I keep getting an error when I run the npm install command.

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to [email protected]^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN prefer global [email protected] should be installed with -g npm WARN prefer global [email protected] should be installed with -g

[email protected] install /var/www/mySite/node_modules/node-sass node scripts/install.js Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-46_binding.node Binary downloaded and installed at /var/www/mySite/node_modules/node-sass/vendor/linux-x64-46/binding.node

[email protected] postinstall /var/www/mySite/node_modules/node-sass node scripts/build.js

"/var/www/mySite/node_modules/node-sass/vendor/linux-x64-46/binding.node" exists. testing binary. Binary is fine; exiting. /var/www/mySite

├── [email protected] ├─┬ [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ ├── [email protected] │ │ ├─┬ [email protected] │ │ │ └── [email protected] │ │ ├── [email protected] ... more garbage npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Have any one seen this error before? Any idea how to solve it?

I tried ...

rm -rf node_modules/ npm cache clean

This is what I have installed. npm -v = 3.10.8 nodejs -v = v4.6.1

18 Oct
2 years ago

fsdolphin left a reply on Error Installing Laravel 5.3

Here is what I did that solved the error.

sudo apt-get install php7.0-mbstring

sudo apt-get install php-xml

sudo chown -R userName /home/userName/.composer

fsdolphin left a reply on Error Installing Laravel 5.3

@bitcoinboy - I'm using Nginx , sorry for not specifying that.

fsdolphin left a reply on Error Installing Laravel 5.3

@bitcoinboy - I ran the two command you suggested and (sudo phpenmod mcrypt sudo phpenmod mbstring) and I get the following warnings...

sudo phpenmod mcrypt

WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.0/mods-available

sudo phpenmod mbstring

WARNING: Module mbstring ini file doesn't exist under /etc/php/7.0/mods-availabl

17 Oct
2 years ago

fsdolphin left a reply on Error Installing Laravel 5.3

@321jurgen , PHP 5.6.4? I have PHP 7.0.12 installed.

By the way, I have used this machine to install previous Laravel version and it was working fine. This is my first time trying to install Laravel 5.3.

fsdolphin started a new conversation Error Installing Laravel 5.3

I get the following error when I try to install Laravel via laravel new blog. I installed PHP7 but still no luck.

Error: Crafting application... Cannot create cache directory /home/superserver/.composer/cache/repo/https---packagist.org/, or dire ctory is not writable. Proceeding without cache Cannot create cache directory /home/superserver/.composer/cache/files/, or directory is not writable . Proceeding without cache Cannot create cache directory /home/superserver/.composer/cache/repo/https---packagist.org/, or dire ctory is not writable. Proceeding without cache Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages.

 Problem 1
 - Installation request for laravel/framework v5.3.18 -> satisfiable by laravel/framework[v5.3.18                                    ].
 - laravel/framework v5.3.18 requires ext-mbstring * -> the requested PHP extension mbstring is m                                    issing from your system.
Problem 2
    - Installation request for phpunit/phpunit 5.6.1 -> satisfiable by phpunit/phpunit[5.6.1].
 - phpunit/phpunit 5.6.1 requires ext-dom * -> the requested PHP extension dom is missing from yo                                    ur system.

 To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini

This is what I get when I check PHP vesion. php -v

PHP 7.0.12-1+deb.sury.org~trusty+1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.12-1+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies

Any idea what could be wrong?

30 Jul
2 years ago

fsdolphin left a reply on Connecting Laravel To Sqlite In Laravel 5.2

@CodeJhonny Yes, later I learned that the key was to stop and re-serve every time a change is made to the .env file. Thank you for resurrecting this question since somebody else will benefit from the answer.

26 Jul
2 years ago

fsdolphin left a reply on How To Reset Laravel Projects To Start With A Fresh Install

@tisuchi It is what I use now, + php artisan serve.

laravel new blog + php artisan serve

08 Jul
2 years ago

fsdolphin started a new conversation Javascript For Beginners Course Missing

Hi,

First of all let me start by saying that I'm by no means a good programmer, I just love programming and do it as a hobby. With that being said, I have played around and created simple applications with languages such as C++, Objective-C, Swift and C#, but for some reason I find Javascript difficult to learn, I hope I'm not the only one.

So, I would love to see a Javascript course for beginners here in Laracasts, a course that shows how to use Javascript in a more Ojbect Oriented way, this could be using Vue.

For instance using Vue...

var message = {
     message: 'Hello World'
};

In the above example message is an object with a property etc.

new Vue({
     el: '#app',
    data: message
});

In the above example, well I don't fully understand it, it is creating a new Vue instance which takes a literal function but it's working without assigning it to a variable...

I don't know but I find the Javascript syntax a little confusing, I hope I'm not the only one.

@JeffreyWay What do you think about course for complete beginners :)?

Thanks

03 Jul
2 years ago

fsdolphin started a new conversation Why Are My Uploaded Photos Automatically Renamed

Hi,

Why are my uploaded photos automatically renamed?

I uploaded two pictures and they end up with the following names... phpCojNCI and phpyIqyDd. Is this normal

Here is the code.

<form method="POST" action="/photos" enctype="multipart/form-data">
          {!! csrf_field() !!}
            <div class="form-group">
                <input type="file" name="name" class="form-control" >
            </div>
            <div class="form-group">
                <input type="submit" class="form-control">
            </div>
</form>


public function store()
{
    $file = Request::file('name');
    $file->move(public_path() . '/images/');
}

Where does the renaming happens?

fsdolphin left a reply on Use Request Vs Use Illuminate\Http\Request

@d3xt3r Makes sense now, thanks a lot for the clarification.

fsdolphin left a reply on Use Request Vs Use Illuminate\Http\Request

@tomo_pongrac @bashy Quick question.

If Illuminate\Http\Request and Request are basically the same thing why Request::all() doesn't work with Illuminate\Http\Request?

This works:

use Request;

    public function store()
    {
        dd(Request::all());
    }

Why this does NOT work?

use Illuminate\Http\Request;

    public function store()
    {
        dd(Request::all());
    }

Thanks.

29 Jun
2 years ago

fsdolphin left a reply on Understanding Mailing/email In Laravel

I see, thanks a lot.

fsdolphin left a reply on Understanding Mailing/email In Laravel

@tomo_pongrac The article talks only about using a service providers and I found the video below her in Laracasts and Jeffrey talks about using gmail as your provider.

Do I really need to use a service provider such as Mailgun or Gmail is also a valid choice?

If either option can be used, what are the pros and cons of using one instead of the other?

Video: https://laracasts.com/lessons/mailers

fsdolphin started a new conversation Understanding Mailing/email In Laravel

Hi,

What are the requirements for sending emails from your app using Laravel.

  1. Do I need to install any additional software in my server such as a mail server etc? In other words, besides configuring your server to work with Laravel (which I already have), is there any other server requirements to be able to send emails?

  2. What would be a good video tutorial? I searched Laracast but all tutorials seem to be old and I'm not sure if they still relevant.

Thanks

28 Jun
2 years ago

fsdolphin left a reply on Understanding Helper Functions

@SaeedPrez In what class is that in?

Thanks