lindstrom

Director of Application Development at AI

Experience

49,255

43 Best Reply Awards

  • Member Since 3 Years Ago
  • 452 Lessons Completed
  • 3 Favorites

17th August, 2017

lindstrom left a reply on Laravel Mix: Prevent Moment.js Locales • 1 month ago

I have one page that requires fullcalendar which has moment as a dependency. I ended up copying moment.min.js directly to public/js rather than loading it through webpack. And, to be clear, I did the same with fullcalendar as well.

There's probably a "right way" to do this so you can bundle it, but ain't nobody got time for that.

16th May, 2017

lindstrom left a reply on Can We Get Exact Updated Field From The Update() • 4 months ago

You can definitely check the retrieved field against some input to be updated before executing the update. However, you have to retrieve the model first.

For example:

$user = User::find(1):

if ($user->age !== $request->age) {
    $user->age = $request->age;
    $user->save;
    // the age was updated - do something
}

Note: models are not retrieved when doing a mass update.

If that's not what you are asking, could you please explain further?

4th April, 2017

lindstrom left a reply on Good Alternative To Var_dumpling Chrome Extension? • 5 months ago

Not familiar with the extension. Could you just use dump() instead?

{{ dump($foo) }}

23rd March, 2017

lindstrom left a reply on I Want To Know What Reason Behind It • 5 months ago

You need to pass an array or collection to @foreach. You're giving it an integer. Try:

public function notification()
{
    $users = DB::table('users')->where('Active', 0)->get();
   

    return view('admin.layout.master', compact($users));
 }

27th February, 2017

lindstrom left a reply on About To Launch My First Real Web Application, What Do I Need To Keep In Mind? • 6 months ago

Use a service like Sentry / Rollbar / Bugsnag or get ready to tail -f laravel.log when you go live. Stay calm, fix bugs as they crop up. Wipe hands on pants, repeat.

31st January, 2017

lindstrom left a reply on The Requested URL Could Not Be Retrieved • 7 months ago

Looks like something to do with Vimeo. I can't watch or download Introducing Laravel Echo: https://laracasts.com/lessons/introducing-laravel-echo

@JeffreyWay any ideas? I also noticed that the Laravel Echo demo Github repo is gone for that video.

25th January, 2017

lindstrom left a reply on 5.3 With XAMPP • 7 months ago

It's not a XAMPP issue. It's that if you precede the path with a "/" it will make the URL relative to the root of your project. Whereas if you don't prefix with "/", it will be relative to the current path.

For example, if you are at http://some.dev/directory

A link to:
<a href-"/upload">Upload</a>

Would resolve to:
http://some.dev/upload

A link to:
<a href="upload">Upload</a>

Would resolve to:
http://some.dev/directory/upload

If you are talking about something else, please provide an example.

In the future, you will find the url(), action() and route() helpers useful, but they are not necessary. Just get your paths and routes correct for now.

lindstrom left a reply on Laravel 5.4 Dev Npm Run Dev Error • 7 months ago

@JeffreyWay

I found that codemirror appears to be an optional dependency of Summernote (jQuery and Bootstrap are it's only published deps: https://github.com/summernote/summernote).

With the same fresh install of L5.4.3.

bower install summernote

Edit webpack.mix.js

mix.copy('bower_components/summernote/dist/summernote.css', 'resources/assets/css/vendor/summernote');
mix.copy('bower_components/summernote/dist/summernote.min.js', 'resources/assets/js/vendor/summernote');

mix.js(['resources/assets/js/vendor/summernote/summernote.min.js', 'resources/assets/js/app.js'], 'public/js/app.js')
   .sass('resources/assets/sass/app.scss', 'public/css');

Run npm run dev results:

This dependency was not found in node_modules:

* codemirror

Did you forget to run npm install --save for it?
                                                                    Asset      Size  Chunks                    Chunk Names
  fonts/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1   20.1 kB          [emitted]
  fonts/glyphicons-halflings-regular.svg?89889688147bd7575d6327160d64e760    109 kB          [emitted]
  fonts/glyphicons-halflings-regular.ttf?e18bbf611f2a2e43afc071aa2f4e1512   45.4 kB          [emitted]
 fonts/glyphicons-halflings-regular.woff?fa2772327f55d8198301fdb8bcfc8158   23.4 kB          [emitted]
fonts/glyphicons-halflings-regular.woff2?448c34a56d699c29117adc64c43affeb     18 kB          [emitted]
                                                               /js/app.js   1.28 MB       0  [emitted]  [big]  app
                                                             /css/app.css    685 kB       0  [emitted]  [big]  app
                                                        mix-manifest.json  66 bytes          [emitted]
                 ../resources/assets/css/vendor/summernote/summernote.css   13.2 kB          [emitted]
               ../resources/assets/js/vendor/summernote/summernote.min.js   92.2 kB          [emitted]

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
// snip irrelevant

Here is the relevant seciton of summernote.js where it checks for codemirror:

  var hasCodeMirror = !!window.CodeMirror;
  if (!hasCodeMirror && isSupportAmd && typeof require !== 'undefined') {
    if (typeof require.resolve !== 'undefined') {
      try {
        // If CodeMirror can't be resolved, `require.resolve` will throw an
        // exception and `hasCodeMirror` won't be set to `true`.
        require.resolve('codemirror');
        hasCodeMirror = true;
      } catch (e) {
        // Do nothing.
      }
    } else if (typeof eval('require').specified !== 'undefined') {
      hasCodeMirror = eval('require').specified('codemirror');
    }
  }

Finally, from within the emitted app.js I the following which appears to have some relevance:

      CodeMirror;agent.hasCodeMirror && (agent.isSupportAmd ? Promise.resolve().then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [!(function webpackMissingModule() { var e = new Error("Cannot find module \"codemirror\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())]; (function (a) {
    CodeMirror = a;
  }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}).catch(__webpack_require__.oe) : CodeMirror = window.CodeMirror);var Codeview = function Codeview(a) {

Let me know if I can offer anything else.

lindstrom left a reply on Laravel 5.4 Dev Npm Run Dev Error • 7 months ago

@JeffreyWay No -- I don't have them in my package.json as they are not dependencies of my project. I think they're being derived as dependencies from some vendor files I have in there for my admin theme (ProUI). Looking at it again now.

lindstrom left a reply on Laravel 5.4 Dev Npm Run Dev Error • 7 months ago

I rm -rf node_modules/ then npm install.

Using new package.json, and my webpack.mix.js, on Windows 10 with latest (7.4) nodejs I get the following when I npm run dev:

These dependencies were not found in node_modules:

* codemirror
* moment
* ../fonts/bootstrap/glyphicons-halflings-regular.eot
* ../fonts/bootstrap/glyphicons-halflings-regular.woff2
* ../fonts/bootstrap/glyphicons-halflings-regular.woff
* ../fonts/bootstrap/glyphicons-halflings-regular.ttf
* ../fonts/bootstrap/glyphicons-halflings-regular.svg

I do have another issue with a vendor js file where webpack is trying to resolve a relative directory within that file and can't, but that's not related.

24th January, 2017

lindstrom left a reply on 5.3 Redirect Action - Not Defined • 7 months ago

Try:

return response()->redirectToAction('Pages\Member\Crew\CrewController@member',
        [$npc]');

And in web.php (see: https://laravel.com/docs/5.3/routing#route-model-binding)

Route::get('/crewmember/{npc}', 'Pages\Member\Crew\CrewController@member');

Finally in CrewController

public function member(NPC $npc)
{
    // no idea what you are trying to do here,
    // but this method needs to return your
    // crewMember view
    $tile = $npc->tile; 

    return view('crewMember', compact('tile');
}

3rd January, 2017

lindstrom left a reply on Laravel 5.3 - Roles And Permissions Provider • 8 months ago

I'm in the middle of this. I reviewed a few packages and decided to roll my own for my limited use case (roles only). However, I missed https://github.com/JosephSilber/bouncer and I'm going to look at it today. Can't recommend one way or another but thought I'd contribute it to the list.

28th December, 2016

lindstrom left a reply on External Monitor Tips • 8 months ago

I'm with @SaeedPrez , I have a Dell XPS 15 and a 27" external at 1920x1080. I'd much prefer dual 27's at a higher resoluation or maybe a single 34". I basically have mirrored my setup in my home office to my work office. Same angles, monitor, mouse, keyboard, laptop stand. It might seem like a small thing, but I have zero config or window dragging (I'm on Windows) when switching from one location to the other. Having ConEmu on the Laptop and everything else on the external works, but some more real estate would be welcome. Plus, for my taste (and eyes), the laptop monitor is just a little bit too far away to be more useful.

19th December, 2016

lindstrom left a reply on Array_key_exists() Expects Parameter 2 To Be Array, Null Given In Serachable • 9 months ago

@neogeninfotech Sweet! Yeah, that turns off full group by in MySQL which is on by default in MySQL 5.7. The default sql modes are pretty annoying so I just set sql_mode='' when I provision a new box (I have a Forge recipe I run and include it in my Homestead's after.sh).

Glad you got it working!

17th December, 2016

lindstrom left a reply on Multiple Seeders And Factories - Is It Possible? • 9 months ago

  • 1 for checking the environment. Seeders are also a convenient place to do ETL. For example, I moved our current app from legacy to Laravel and am now updating the underlying architecture. I've built a number of seeders that will populate new tables with data from existing tables as well as populate a few reference tables. However, it's a one shot deal. I can't see a use case for reusing a seeder after it's been run in production (successfully).

16th December, 2016

lindstrom left a reply on Array_key_exists() Expects Parameter 2 To Be Array, Null Given In Serachable • 9 months ago

Sorry @neogeninfotech I didn't add the table and priority. What happens when you write it like this:

protected $searchable = [
    'columns' => [
        'users.name' => 10,
    ],
];

15th December, 2016

lindstrom left a reply on Array_key_exists() Expects Parameter 2 To Be Array, Null Given In Serachable • 9 months ago

Reread https://github.com/nicolaslopezj/searchable

protected $searchable = [
    'columns' => [
        'name',
    ],
];

13th December, 2016

lindstrom left a reply on Is It Just Me? • 9 months ago

I remember those early days of hitting the space bar and alt-tabbing back and forth to code and follow along all too well. I think everyone new here has thought the same thing about the pacing. The thing is, just take your medicine and pause/tab back and forth and grind through those first few series. After that, go through Be Awesome in PhpStorm/Sublime. Get yourself a nice little sandbox set up for local dev. Get comfortable with creating new laravel projects. Abandon anything that rhymes with AMP for Homestead or Valet.

Trust me, one day you'll be watching a lesson and wondering what's taking him so long and you'll actually speed up the videos. The only way you'll remember what Jeffrey actually sounds like is to listen to the Snippets podcast... until you realize you have that on 1.5x too.

lindstrom left a reply on Want To Load Country List From Database Table In Blade • 9 months ago

There are lots of ways to do this and unless I'm missing your intent, this is the simplest way:

public function edit(User $user)
{
    $user->load('country', 'prefecture');
    $countries = Country::select('id', 'name')->get();
      
        return view('users.edit', compact('user', 'countries'));
    }

Then of course you can loop over $countries in your view to build up a select or whatever.

Don't forget to import the Country class.

10th December, 2016

lindstrom left a reply on Why Did Laravel Valet Switch To Nginx? • 9 months ago

Adam said they ran into some obscure bugs with the Valet use case of Caddy that they didn't see getting sorted out.

https://twitter.com/adamwathan/status/807230695089340417

https://github.com/mholt/caddy/issues/1204

8th December, 2016

lindstrom left a reply on Stopping The Form From Refreshing, Jquery, Ajax And Laravel • 9 months ago

I don't like client-side validation. You have to do it on the server anyway unless you're all #yolo.

$('#commnetForm').on('submit', function(e) {
    var form = $(this);
    $.ajax([
        url: form.prop('action'),
        data: form.serialize(),
        success: function (data) {
            // do some cool stuff like returning a rendered comment
            $('.comments').append(data);
            // OR just display a message
            $('#success').html(data);
            $('#formDiv').html('');
        },
        error: function (data) {
            // display the error (note: you have to work harder when there is
            // an array of errors returned
            var error = data.responseJSON;
            $('#formDiv').html('<span style="color:red;">' + error.body + 'A message</span>');
        }
    });
});

Either create a form request or validate in the controller method. Personally, I prefer a form request. Laravel will return the the JSON representation of the response with a status code of 422 automatically:

php artisan make:request CommentRequest

CommentRequest.php

public function authorize(
{
    return true;
}

public function rules()
{
    return [
        'body' => 'required|min:6',
    ];

Controller

<?php

namespace App\Http\Controllers;

use App\Http\Requests;

class CommentController
{
    public function store(CommentRequest $request)
    {
        // store the request
        $comment = Comment::create($request->all());

        // return rendered view as a string:
        return view('comment', compact('comment')->render();
        // or maybe just a success message
        return ressponse()->json([
                'success' => true,
                'msg' => 'Thanks for the comment!',
            ], 200);


    }
}

We could get more specific if I knew what you wanted to achieve in the view for success/failure cases.

6th December, 2016

lindstrom left a reply on (Javascript Error; Uncaught SyntaxError: Missing ) After Argument List) • 9 months ago

Try:

<script type="text/javascript">
    $('#districs').on('change', function(e){
        e.preventDefault();
        var kec_id = $("input[name='kec_id']").val();
        console.log(kec_id);
        $.get('/ajax-vilObj = ' + kec_id, function(data){
            console.log(data);
        });
    });
</script>

lindstrom left a reply on (Javascript Error; Uncaught SyntaxError: Missing ) After Argument List) • 9 months ago

You're missing a comma:

$('#districs').on('change', function () {
   // the rest is fine

Also, you probably mean to spell 'districs' as 'districts' but that is beside the point.

HTH!

4th December, 2016

lindstrom left a reply on HI, I Can't Seem To Get My Ajax Call Working • 9 months ago

Based on your response, I'm guessing you just want to validate email when the input loses focus. You still have to deal with the idea someone could not fill it out at all. Server or JS or give the field focus on page load for that--your call. At any rate, you could do your ajax like this:

$("#regemail").on('keyup blur', function (e) {
    e.preventDefault();
    var email = $(this).serialize();
    $.ajax({
        type: form.prop('method'),
        url: form.prop('action'),
        data: email,
        success: function (data) {
            // success stuff
        },
        error: function (data) {
            var errors = data.responseJSON;
            var errorsHtml = '<div class="alert alert-danger animation-fadeInQuick"><ul class="list-unstyled">';
            $.each(errors, function (key, value) {
                $.each(value, function (key, value) {
                    errorsHtml += '<li><i class="fa fa-close"></i> ' + value + '</li>';
                });
            });
            errorsHtml += '</ul></div>';
            $('#errors').html(errorsHtml);
            $('#success').html('');
        }
    });
};

You can either do the validation directly in the controller or you can create a form request as I alluded to in my previous response. Since you have a dedicated controller method, I don't see anything wrong with::

public function checkUsername(Request $request)
{
    $this->validate($request, ['email' => 'required|unique:users']);
}

From the docs, we then know: "When using the validate method during an AJAX request, Laravel will not generate a redirect response. Instead, Laravel generates a JSON response containing all of the validation errors. This JSON response will be sent with a 422 HTTP status code."

Finally, in your success: and error: functions you can target the message to an appropriate selector in your form.

3rd December, 2016

lindstrom left a reply on HI, I Can't Seem To Get My Ajax Call Working • 9 months ago

You're doing way too much in jQuery relative to validation. Do the validation in a form request . If validation fails, it will be returned as a json response with a 422 status code. See: https://laravel.com/docs/5.3/validation#form-request-validation

Loop over the errors in the response and display them to the user. You AJAX call might look something like:

$("#register-btn").on('submit', function(e) {
    e.preventDefault();
    var form = $(this).closest('form');
    $.ajax({
        type: form.prop('method'),
        url: form.prop('action'),
        data: form.serialize(),
        success: function(data) {
            // success stuff
        },
        error: function(data) {
            var errors = data.responseJSON;
            var errorsHtml = '<div class="alert alert-danger animation-fadeInQuick"><ul class="list-unstyled">';
        $.each(errors, function (key, value) {
            $.each(value, function(key, value) {
                errorsHtml += '<li><i class="fa fa-close"></i> ' + value + '</li>';
            });
        });
        errorsHtml += '</ul></div>';            
        $('#errors').html(errorsHtml);
        $('#success').html('');
        }
    });
};

Add a couple empty divs at the top to contain your success/errors. If you are going to render a different view on success don't need the success function or to clear previous errors with $('#success').html('');.

HTH!

1st December, 2016

lindstrom left a reply on Test-Driven Laravel By Adam Wathan Is Very Good!!! • 9 months ago

Eric Barnes had early access and gave a short review: https://laravel-news.com/2016/11/review-of-test-driven-laravel/

Grabbed it when it came out but need to get a chunk of time to plow through it.

30th November, 2016

lindstrom left a reply on Alter Table Change Field To LONGTEXT; • 9 months ago

@janokary -- Ahh cool (not cool). Thanks for following up.

29th November, 2016

lindstrom left a reply on Create A Select Based On GroupBy 'created_at' • 9 months ago

Let's skin it a different way:

$result = Campaign::selectRaw("date_format(created_at, '%Y') as dt")
    ->groupBy('dt')
    ->get();

$years = array_combine($result->pluck('dt')->all(), $result->pluck('dt')->all());

There's probably a better way, but this is pretty straightforward in my mind.

23rd November, 2016

lindstrom left a reply on Help Please? How To Get The Last 10 Rows Of A Table? • 9 months ago

Stupid Javascript. Thanks @zachleigh for the enlightenment.

lindstrom left a reply on Help Please? How To Get The Last 10 Rows Of A Table? • 9 months ago

Dude, you aren't making any sense.

message 1 // i'm brand new. full of hope and optimism
. . . 
message 10 // i'm a geezer 'bout to join the choir eternal

New bro comes and adds a message

message 1 // yo, i'm the newest bro, bro.
message 2 // i was #1. fml
. . . 
message 10 // i'm old and busted 

What you are requesting would be to chop off the newest messages and that seems pretty pointless.

I suppose there is one rational explanation...you want to reverse the order in which you are looping over the messages for display. In that case:

return $chatMessage->reverse();

Such that you'd have:

message 10 // oldest message - goodbye cruel world
. . . 
message 1 // wee, i'm poppin' fresh, yo

Along comes a new message...

message 10 // i was 9, but now i'm 10
. . .
message 2 // hey, i used to be #1
message 1 // 'sup, i'm new here. a/s/l?

Am I even close? At any rate, let me know if I'm way off base.

Also, start a new thread next time instead of completely updating your original. Your update totally contradicts what you asked and makes the replies we left seem crazy.

22nd November, 2016

lindstrom left a reply on Alter Table Change Field To LONGTEXT; • 9 months ago

NP. Not sure what's going with your set up. For fun, I also seeded with 100,000 records then changed just to ensure it was working with a decent amount of data. Other than taking a minute or two, it was fine. I didn't want to leave this thread without being a little more thorough and I always feel like an answer of "works for me" is pretty unsatisfying. Sorry.

lindstrom left a reply on Alter Table Change Field To LONGTEXT; • 9 months ago

Worked fine for me (L5.3 / MySQL5.7.10):

Requiring in composer.json

        "doctrine/dbal": "^2.5",

Test migration:

Schema::create('test_migrations', function (Blueprint $table) {
    $table->text('test');
});

Change:

Schema::table('test_migrations', function ($table) {
    $table->longText('test')->nullable()->change();
});

And the before and after: ()[http://imgur.com/a/kVhRB]

I think altering the table directly is fine and probably what most people would do. However, as you may know, there are some gotchas when you you want to do this on a table with a lot of data in production--mainly that it can take forever. See for example how one might speed it up: http://dba.stackexchange.com/questions/9746/mysql-fastest-way-to-alter-table-for-innodb

lindstrom left a reply on Alter Table Change Field To LONGTEXT; • 10 months ago

I'm actually working on some migrations so I could test this easily. I was able to change a string to longText using ->nullable()->change(). Did you require dbal?

composer require doctrine/dbal

21st November, 2016

lindstrom left a reply on Help Please? How To Select The Last 10 Rows? In Asc Order? • 10 months ago

$chatMessage = ChatMessage::with('user.role')
                 ->oldest()
                 ->limit(10)
                 ->get();

Produces exactly the same result as @willvincent but takes into account you tried latest() which is just ORDER BY created_at DESC whereas oldest() will give you ORDER BY created_at ASC and that take() is just an alias of limit().

If you give latest() or oldest() a date column other than created_at, it will order by that column instead.

$chatMessage = ChatMessage::with('user.role')
                 ->oldest('updated_at')
                 ->limit(10)
                 ->toSql();

All that said, I actually think using orderBy() is less confusing but maybe that's me coming from writing tons of SQL before using any ORM's.

If you want to see the SQL produced by the query builder you can always use the toSql() method:

$chatMessage = ChatMessage::with('user.role')
                 ->oldest()
                 ->limit(10)
                 ->toSql();

dd($chatMessage);

to get the query if that's helpful to you when debugging a query.

20th November, 2016

lindstrom left a reply on Rename User.php - Roles And Permissions (Laravel 5.3) • 10 months ago

@jekinney yes, no model required. Force of habit from php artisan make:model Model -m. And +1 for linking the docs.

lindstrom left a reply on Rename User.php - Roles And Permissions (Laravel 5.3) • 10 months ago

Now that you've changed User to Member, the convention assumes your pivot table will be member_role rather than role_user. Do you have that table? The error simply states member_role doesn't exist.

Create a migration with a table named member_role and a model to go with it called Member role. These will replace the migration for role_user and the RoleUser model.

lindstrom left a reply on Swift_TransportException In StreamBuffer.php Line 269 Connection Could Not Be Established With Host Name Or Service Not Known #0] • 10 months ago

Your host, mail.brownrice.com, can't be resolved. Taking a look, I don't see mail. mx records only spam1 and spam2: http://mxtoolbox.com/SuperTool.aspx?action=mx%3abrownrice.com&run=toolpage#

Your email server doesn't report supporting tls. Are you sure about port/encryption?

At any rate your main problem is that mail.brownrice.com can't be resolved.

lindstrom left a reply on Rename User.php - Roles And Permissions (Laravel 5.3) • 10 months ago

Yes, you can and your changes look correct to me. Did you php artisan clear-compiled and composer dumpautoload?

And, as @rdelorier says, the error log would be useful.

lindstrom left a reply on File Delete Not Actually Deleting A File • 10 months ago

@heihachi88 Zero downtime deployments in this case. Specifically, the way Envoyer deals with maintains the files in storage. Check out the link above: "The Public Disk" and see: https://laracasts.com/series/envoyer/episodes/2 as well as what was mentioned up thread about it.

You store everything created or uploaded on your server in storage/app/public and use php artisan storage:link to create a symbolic link from storage/app/public to public/storage. In fact, that would be a web hook you'd run during your deployment.

Envoyer takes the hassle out of managing the symlinking and rotating new deployments. Plus, you can fall back to a previous deployment with a click. If you are doing it manually, the $100/year is worth it for the time it saves you alone.

In terms of maintaining those files across deployments, the only way I see it working out is if you are just syncing over SSH or something. And, that's FINE if this is just a hobby or you're just getting started, but only crazy people do that with apps that make money for them or for the business for which they work.

Anyway, check it out. I use both Forge and Laravel at work. Love them both to pieces.

lindstrom left a reply on Validation Isn't Processed If I Submit A Form By Calling .submit() In JavaScript • 10 months ago

Sorry for the swing and mis(understanding). So, if you submit the form with jQuery's .submit() method, are you saying your form request class is bypassed on your store() method? Then the data is processed by whatever logic you have in that method? AFAIK, that's not possible.

Any chance the validation is simply not failing with the request data it is receiving?

I'd start by looking at the data being submitted as well as how it would be handled by your validation. If I'm wrong again about this and you still don't have it sorted, post as much of your code as you can and I'll either help you figure it out or narrow it down.

19th November, 2016

lindstrom left a reply on Validation Isn't Processed If I Submit A Form By Calling .submit() In JavaScript • 10 months ago

Be useful if you showed what condition(s) you are checking before submit, but...

$(".content-submit").on('click', function(e){
    e.preventDefault();
    //Check the form
    var testVal = $('#example-selector').val();
    if (!testVal) {
        alert('Need an example value, pal-y!');
        return false; // stops execution
    }   
    $(".content-form").submit();
});

I'm generally doing my submissions with Ajax and rendering the view as a response. If you want to go down that rabbit hole, let me know. Spoiler, it's pretty simple.

17th November, 2016

lindstrom left a reply on File Delete Not Actually Deleting A File • 10 months ago

@heihachi88 Cool! Someone suggested using the Storage facade instead. I think it's fine either way. Storage uses the 'local' disk by default and assumes your path is storage_path('app'). You'll also see a public disk with the default path storage_path('app/public') and the docs explain why storing your publicly accessible files here can be a good idea: https://laravel.com/docs/5.2/filesystem#configuration

The tl;dr is that you'll end up wishing you had done it that way to begin with if you start using Envoyer or something similar for deployments.

lindstrom left a reply on File Delete Not Actually Deleting A File • 10 months ago

@heihachi88

Then you would need:

\File::delete(public_path($path));

You can always dd(p

Forgot about the public_path() helper. At any rate, you need to use the absolute path.

lindstrom left a reply on File Delete Not Actually Deleting A File • 10 months ago

What is in $path?

You need to pass the absolute path of the image to File. So if $path hold the relative path (public/uploads/image.png).

If that's the case you need:

\File::delete(base_path($path));

I wrote a bunch of words about this the other day: https://tenerant.com/blog/deleting-files-laravel-php/

lindstrom left a reply on Best Place To Register A Domain? • 10 months ago

@balistikbill I use Route 53 because a) no one is going to successfully DDOS it and b) You have to use Route 53 to map a subdomain to an S3 bucket c) registrar DNS interfaces are generally pretty crappy. On GD, how many times do you forget to hit that extra save?

WRT name.com charging $12.99 - I think they just raised their pricing. At any rate, it's easy to find a promo code: https://www.retailmenot.com/view/name.com <- reg and renewals for $9.99.

lindstrom left a reply on How To Check Condition For Css Class. • 10 months ago

@spekkionu bah, you're right. I completely missed it.

lindstrom left a reply on Is PHP Still A Widely In-demand Skill? • 10 months ago

It's definitely in demand. If you are just starting out, PHP/Laravel is as good a place to start as any. Plus, you can't be/call yourself a developer as a one-trick pony. You will likely specialize, but there's no avoiding learning a little (and sometimes a lot) of everything else.

Laravel growing by leaps and bounds, but don't necessarily expect to end up someplace that only does Laravel. There is more legacy PHP code/apps and WordPress out there than you can shake a million sticks at.

One final thought, check job postings in your area and see what's popular locally.

lindstrom left a reply on Ajax Post Request Causes 500 Internal Server Error • 10 months ago

Try serializing the form data. Much simpler:

$('.del-image').click(function() {
    var form = $(this).closest('form');
    $.ajax({
        type: 'POST',
        url: form.prop('action'),
        data: form.serialize(),
           success: function(data) {
                console.log("removed image");
                window.location.reload();
            },
            error: function(e) {
                alert('Error' + e);
            }
        });
    });

lindstrom left a reply on Append ReadOnly Jquery • 10 months ago

I'm assuming you will only have one option. You're looking for:

$('#search-result').prop('disabled', true);

Put it above your $.each.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.