Aron-Spiess

Aron-Spiess

Member Since 8 Months Ago

Experience Points 1,940
Experience
Level
Lessons Completed 9
Lessons
Completed
Best Reply Awards 0
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.

09 Dec
1 week ago

Aron-Spiess started a new conversation Sql Raw In Model::method()

having trouble with eloquent accepting raw sql statement, rest of query works and returns collection.

        $return = Leader::leadertiles()
            ->select('seq_no', 'tile_type', 'tile_name', 'links_to', 'isactive', 'relation_id','sort_order'
                ,Leader::leadertiles() - raw - ("MAX(GREATEST(l1_created,l2_created,l3_created,l4_created)) as created_at")
                ,Leader::leadertiles() - raw - ("MAX(GREATEST(l1_updated,l2_updated,l3_updated,l4_updated)) as updated_at"))
            ->groupBy('seq_no', 'tile_type', 'tile_name', 'links_to', 'isactive', 'relation_id','sort_order')
            ->get();

Aron-Spiess left a reply on Change A Db Raw To A Collection

Thanks, this just help to realize I need to review each query and ensure there's results

07 Dec
1 week ago

Aron-Spiess started a new conversation Change A Db Raw To A Collection

how do I change this query to a collection of data?

$commons = \DB::table(\DB::raw("({$all->toSql()})x"))
            ->select('seq_no', 'tile_type', 'tile_name', 'links_to', 'isactive', 'relation_id','sort_order'
                ,\DB::raw("MAX(GREATEST(l1_created,l2_created,l3_created,l4_created)) as created_at")
                ,\DB::raw("MAX(GREATEST(l1_updated,l2_updated,l3_updated,l4_updated)) as updated_at"))
            ->groupBy('seq_no', 'tile_type', 'tile_name', 'links_to', 'isactive', 'relation_id','sort_order')
            ->get();

Aron-Spiess left a reply on Joining On Query Referenced By Variable

I figured out the subJoin part, but now I need to figure out how to join two of these together.

$all = ($l1, 'l1')
            ->leftJoinSub($l2, 'l2', function ($leftJoin2) {
                $leftJoin2->on('l1.l1_rel_seq_no','=','l2.l2_parent_seq_no');})

Aron-Spiess left a reply on Joining On Query Referenced By Variable

joinSub seems to work

Aron-Spiess started a new conversation Joining On Query Referenced By Variable

How do I make this work?

        $top = \DB::table('metrics_tiles AS t')
            ->select('t.seq_no','t.tile_type','t.tile_name','t.links_to','t.isactive','t.relation_seq_no AS relation_id')
            ->where([
                ['t.isdisplayed', '=', '1']
                ,['t.parent_seq_no', '=', 1]
            ]);


        $l1 = \DB::table('metrics_tiles AS l1')
            ->join($top->from('top',$top),'l1.parent_seq_no','=','top.relation_id')
            ->select('top.seq_no AS top_seqno','top.tile_type AS top_type','top.tile_name AS top_tile','l1.tile_name AS l1_tile','top.links_to AS top_link','top.isactive','top.relation_id'
            ,'l1.relation_seq_no AS l1_rel_seq_no', 'l1.created_at AS l1_created', 'l1.updated_at AS l1_updated', 'l1.parent_seq_no AS l1_parent')
            ->toSql();

I can't seem to figure out how to reference my variable, alias it, then join off of it.

Aron-Spiess left a reply on Alias A $collection With A Join

figured it out, just use from

$all = $l1->from('l1',$l1)

Aron-Spiess left a reply on Alias A $collection With A Join

figured it out

$l1 = \DB::table('metrics_tiles AS l1')
            ->join('top',function($top){
                $top->on('l1.parent_seq_no','=','top.relation_id');
            })
        ->select('top.seq_no AS top_seqno','top.tile_type AS top_type','top.tile_name AS top_tile','l1.tile_name AS l1_tile','top.links_to AS top_link','top.isactive','top.relation_id'
        ,'l1.relation_seq_no AS l1_rel_seq_no', 'l1.created_at AS l1_created', 'l1.updated_at AS l1_updated', 'l1.parent_seq_no AS l1_parent');

Aron-Spiess started a new conversation Alias A $collection With A Join

i'm trying to do the following

$l1 = \DB::table('metrics_tiles AS l1')
            ->innerJoin("$top as top",'l1.parent_seq_no','=','top.relation_id')
            ->select('top.seq_no AS top_seqno','top.tile_type AS top_type','top.tile_name AS top_tile','l1.tile_name AS l1_tile','top.links_to AS top_link','top.isactive','top.relation_id'
                ,'l1.relation_seq_no AS l1_rel_seq_no', 'l1.created_at AS l1_created', 'l1.updated_at AS l1_updated', 'l1.parent_seq_no AS l1_parent');

$top is a collection from a separate query, I can't seem to requery just that past query and do a join

28 Nov
2 weeks ago

Aron-Spiess left a reply on Sticky Headers Not Working After Closing Browser

Thanks this worked, I also had to get rid of ie compatibility mode

27 Nov
2 weeks ago

Aron-Spiess started a new conversation Sticky Headers Not Working After Closing Browser

I've got some dynamic html tables that get built from some queries. The page is essentially a report with sections that contain multiple tables. Any way the code works, and even works when I code over the example with my own code; however, after I close the browser and come back the sticky headers no longer work. I tried moving the jquery to the bottom of the page. I tried changing the document ready short hand to window load. Still it doesn't work.

header style

        .floatingHeader {
            position: fixed;
            top: 0;
            visibility: hidden;
            margin: 0;
        }

header jquery 1.6.2

    function UpdateTableHeaders() {
           $(".persist-area").each(function() {

               var el             = $(this),
                   offset         = el.offset(),
                   scrollTop      = $(window).scrollTop(),
                   floatingHeader = $(".floatingHeader", this)

               if ((scrollTop > offset.top) && (scrollTop < offset.top + el.height())) {
                   floatingHeader.css({
                    "visibility": "visible"
                   });
               } else {
                   floatingHeader.css({
                    "visibility": "hidden"
                   });      
               };
           });
        }

        // DOM Ready      
        $(function() {

           var clonedHeaderRow;

           $(".persist-area").each(function() {
               clonedHeaderRow = $(".persist-header", this);
               clonedHeaderRow
                 .before(clonedHeaderRow.clone())
                 .css("width", '100%')
                 .addClass("floatingHeader");

           });

           $(window)
            .scroll(UpdateTableHeaders)
            .trigger("scroll");

        }); 

section with persistent-area

<section class="some-other-area persist-area">
    <include>
</section>

include with table

    <table align="center" class="results_smlog" style="width:900px;">
        <thead>
            <tr class="persist-header" style="width:100%;">
                <th class="mainhead" align="center" style="width: 150px;">Ticket</th>
                <th class="mainhead" align="center" style="width: 100px;">State</th>
                <th class="mainhead" align="center" style="width: 613px;">Short Description</th>
            </tr>  
        </thead>
        <tbody>
        </tbody>
07 Aug
4 months ago

Aron-Spiess left a reply on Individual Message Per Required_if Validation

I'd like to learn more about a custom getAttribute fuction. But that will happen when I have more time. Thanks Tykus!

Aron-Spiess started a new conversation Individual Message Per Required_if Validation

The following is in my update function. I'm trying to show the custom message rather than the value, or better yet just show the option text from my select menu.

        $rules = Validator::make($data, [
            'title' => 'required|min:2',
            'application' => 'required_if:access_type,==,1',
            'group' => 'required_if:access_type,==,2,',
            'search_string' => 'required|min:4',
        ],[
            'application' => 'The application field is required when access type is an application.',
            'group' => 'The group field is required when access type is a global group.',
        ]);

this is what's returning, I don't want the number value.

"The application field is required when access type is 1."

12 Jul
5 months ago

Aron-Spiess started a new conversation Working With Datatables And Other Collections

I need some help with returning more than just the datatables data, I'd like to return results from two other sql queries.

// normal way to call back the datatable
        return DataTables::of($comments_list)
            ->rawColumns(['title'] ,['comment'] ,['created_by'] ,['comment_date'])
            ->make(true);
// normal way to call back sql query collections
return view('dashboard.commentslist', compact('owners','admins'));

I assume I can add the compact('owners','admins')); but when I try to reference these in my blade I get an undefined variable

04 Jul
5 months ago

Aron-Spiess left a reply on Ajax Request Not Showing On Return View

// metrics.blade.php view

   <script type="text/javascript">
        $(function(){
            // Enables popover
            $("[data-toggle=popover]").popover();
        });

        var viz;
        var workbook;
        var activeSheet;

        function tabSwitch() {

            //alert(activeSheet);
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                type: "GET",
                url: "{{route('comment.return_comment')}}",
                data: {activeSheet:activeSheet},
                dataType : "json",
                success: function(response) {
                    console.log(response);
                }
            });
        };

        window.onload = function () {
            var vizDiv = document.getElementById('container-metric');
            var visURL = "{{$metrics->tile_url}}";
            var options = {
                width: '{{$metrics->tile_width}}px',
                height: '{{$metrics->tile_height}}px',
                background: 'white',
                hideTabs: {{$tabs}},
                hideToolbar: {{$toolbar}},
                onFirstInteractive: function () {

                    workbook = viz.getWorkbook();

                    activeSheet = workbook.getActiveSheet().getName();

                    tabSwitch();

                }

            };
            viz = new tableau.Viz(vizDiv, visURL, options);

            //add Event Listener

            viz.addEventListener('tabswitch', function (event) {

                activeSheet = workbook.getActiveSheet().getName();

                tabSwitch();

                //alert("TAB CHANGE");

                //console.log(event);

            });

        };
        var tableau;
    </script>


// body with sidebar overlay, this include works as expected

           <div class="overlay"></div>

            @include('dashboard.comment_create')    <!--- this comment does not display 
                                                here even though chrome shows it 
                                                --->

            <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
                <i class="glyphicon glyphicon-comment"></i>
                <span>Comments</span>
            </button>

            <script type="text/javascript">

                //https://bootstrapious.com/p/bootstrap-sidebar

                $(document).ready(function () {
                    $("#sidebar").mCustomScrollbar({
                        theme: "minimal"
                    });

                    $('#dismiss, .overlay').on('click', function () {
                        $('#sidebar').removeClass('active');
                        $('.overlay').fadeOut();
                    });

                    $('#sidebarCollapse').on('click', function () {
                        $('#sidebar').addClass('active');
                        $('.overlay').fadeIn();
                        $('.collapse.in').toggleClass('in');
                        $('a[aria-expanded=true]').attr('aria-expanded', 'false');
                    });
                });
            </script>

// comment_create.blade.php

<!-- Sidebar Holder -->
    <nav id="sidebar">
        <div id="dismiss">
            <i class="glyphicon glyphicon glyphicon-remove"></i>
        </div>

        <div class="sidebar-header">
            <h3>Comments</h3>
        </div>


        <form action="../comments" method="post" class="pure-form pure-form-aligned">
            <fieldset>

                {{csrf_field()}}

                @if(!empty($comment))
                    <?php $commentseqno = $comment->seq_no; ?>
                    <?php $title= $comment->title; ?>
                    <?php $comments = $comment->comment; ?>
                    <?php $createdBy = $comment->created_by; ?>
                    <?php $metaData = $comment->meta_data; ?>
                    <?php $metricKey = $comment->metric_key; ?>
                @else
                    <?php $title = ''; ?>
                    <?php $comments = ''; ?>
                    <?php $createdBy = ''; ?>
                    <?php $metaData = ''; ?>
                    <?php $metricKey = ''; ?>
                @endif

                <!-- hidden fields -->
                    @if(!empty($comment))
                        <input type="hidden" name="comment_seqno" id="comment_seqno" value="{{$commentseqno}}">
                        <input type="hidden" name="created_by" id="created_by" value="{{$createdBy}}">
                        <input type="hidden" name="meta_data" id="meta_data" value="{{$metaData}}">
                        <input type="hidden" name="metric_key" id="metric_key" value="{{$metricKey}}">
                    @endif

                @include('sections.commentform')

                <hr>

                {{$comments}}    <!--- this is where I expect the comment to show 
                            only appears when I run comment_create.blade.php by             
                            itself rather than an include  --->

            </fieldset>
        </form>

    </nav>
// controller
    // show max seq_no and comment from ajax post using unique metric key
    public function return_comment(Request $request)
    {
        $inputs = \Request::all();

        $metric_key = reset($inputs);

        // get comment related to metric_key.
        $comment = \DB::table('metrics_comments')
            ->where('seq_no', \DB::raw("(select max(seq_no) from metrics_comments
                                    where metric_key = '$metric_key')"))
            ->get()
            ->first();

        return view('dashboard.comment_create', compact('comment'));
    }
03 Jul
5 months ago

Aron-Spiess started a new conversation Ajax Request Not Showing On Return View

I can't seem to get my ajax request to return its success back to my view. I suspect it's probably because my view is an include rather than part of the actual page. And my ajax does not do anything with the success. I expected the controller would return the data to the include, but it seems not to. It's probably a matter of timing.

Everything posts correctly with no errors and if I display only the include page then it displays what I expect.

My return view with include still thinks my return from the controller is empty.

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

Got it working. Ended up changing my "post" route to "get".

// getting all the request parameters and then returning just the first parameter
$inputs = \Request::all();

$input = reset($inputs);

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

I did that so I could see the data, when I do just this

$identifier =  $request->activeSheet;

I get my past error: "Object of class stdClass could not be converted to string"

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

I did a dd($request) and I see the value I need, just need a way to decode the request and get the only string I need

  "<span class=sf-dump-key>**activeSheet**</span>" => "<span class=sf-dump-str title="25 characters">**Monthly Features Accepted**</span>"

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

the response tab says: Object of class stdClass could not be converted to string in file /app/laravel-simple-ldap-auth/vendor/laravel/framework/src/Illuminate/Support/Str.php on line 338

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

I added the csrf token but I'm still getting a 419

$.ajaxSetup({
      headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

Aron-Spiess left a reply on Trying To Send Js Variable After Load To Controller

I don't think I can do the second option; my tabs are using the tableau js api; unless I can figure out a way to trigger the unique key to display in the url. Currently my progress consists of grabbing the current tab and any tab switch. I'll post my code in a minute... not at my work pc

02 Jul
5 months ago

Aron-Spiess started a new conversation Trying To Send Js Variable After Load To Controller

My site has some pages that have javascript tabs. Each tab has a unique identifier. I'd like to send that unique identifier to a controller so I can query info using that unique identifier on page load and return the results to the page

20 Jun
5 months ago

Aron-Spiess started a new conversation Can't Seem To Update A Database Record

I have a form that writes a 1 record, sounds pretty easy right...

But when I try to edit what I just created, the form submits again as if I did a post store...

here's my code:

AccessController:

namespace App\Http\Controllers;

class AccessController extends Controller
{

    public function access($id)
    {
        // get access group
            select query
            ->where('seq_no', '=', $id)

    return view create
    }

    public function create()
    {
        // get access group
        select query
    ->where('seq_no', '=', $id)

        return view create
    }

/// this is what runs even though I'm updating
    public function store()
    { 
    \app\model::create([ columns and request fields ])
    return redirect index page
     }

    public function edit($id)
    { 
    select query
    ->where('seq_no', '=', $id)

        return view edit view
    }
    public function update()
    {
    validate some fields
    update field array
    update statement
    
    return redirect /view/$id/edit
    }
}

routes\web.php

// form for creating a Secure Access group relation
Route::get('/access/create','[email protected]')->name('access.create');

// form for creating a Secure Access group relation
Route::get('/access/{id}/edit','[email protected]')->name('access.edit');

// form for posting an update to an access group
Route::post('/access/{id}','[email protected]');

// form for posting an access group to database
Route::post('/access','[email protected]');

// get access view i.e. nhs tableau prod view
Route::get('/access/{id}','[email protected]')->name('access');

edit form and create form action post

create: action="../access"
edit: action="/index.php/access"
18 Jun
5 months ago

Aron-Spiess left a reply on Check If Authenticated Username Equals

I'm validating against an ldap database and using the username which will always be unique.

Aron-Spiess left a reply on Check If Authenticated Username Equals

I ended up using a combination of the last two answers

Aron-Spiess started a new conversation Check If Authenticated Username Equals

I can't seem to verify if a username equals anything. I want to identify a couple of usernames as admins then redirect those users to an admin page and redirect others back to my index. I am able to redirect users back to the index only so far.

06 May
7 months ago

Aron-Spiess left a reply on Ldap Authentication

Is there an update to this?

10 Apr
8 months ago

Aron-Spiess left a reply on Need Correct Usage Of Unions

i ended up just writing it in sql.

Aron-Spiess started a new conversation Need Correct Usage Of Unions

I keep getting a "collection" error followed by a number

   // get employee ids of direct reports to vp
        $directs = \DB::table('metrics_employees')
            ->select('employee_id')
            ->where([
                ['supervisor_Id', '=', '010101010'],
                ['status', '=', 'Active']
            ]);

        // get direct reports to vp
        $uniondirects = \DB::table('metrics_employees')
            ->select('seq_no','name_full','user_id')
            ->where([
                ['supervisor_Id', '=', '010101010'],
                ['status', '=', 'Active']
            ])
            ->get();

        // get direct reports to direct reports of jamie and then union results
        $managers = \DB::table('metrics_employees')
            ->select('seq_no','name_full','user_id')
            ->whereIn ('supervisor_Id', $directs)
            ->where ('status', '=', 'Active')
            ->unionAll($uniondirects)        /***this is breaking  ****/
            ->get();

        $leaders = \DB::table(DB::raw("({$managers -> toSql()}) as l"))
            ->join('metrics_employees as s','l.Supervisor_Id','=','s.Employee_Id')
            ->select('s.name_full AS supervisor','l.seq_no','l.name_full','l.user_id')
            ->get()
            ->toArray();
07 Apr
8 months ago

Aron-Spiess left a reply on Watchlist Remove Buttons Labelled "add To Watchlist"

is it me or when I try to save something to my watch list, nothing gets marked permanently in my watch list.

22 Mar
8 months ago

Aron-Spiess started a new conversation How To SelectRaw Two Or More Columns

I assume I'm not going to use selectRaw to select two columns, but I don't understand what to write inside my controller. The following does not seem to work, it errors with "Class 'App\Http\Controllers\DB' not found", basically don't want to always use the model; I want to be able to use multiple tables and multiple columns.

$services = DB::table('metrics')
->select('seq_no','tile_name')
->where('tile_type', '=', 'service')
->orderBy('tile_name', 'asc')
->get();
->toArray;

Aron-Spiess left a reply on How To Pass {id} From Url To Controller

okay, got it working thank you all. Here's what I had:

web.php:
Route::get('metrics/{id}','[email protected]')->name('metrics');

MetricsController:
->first()    // this must be declared, just -get() was not cutting it.\

view:
{{$metrics->url}}
21 Mar
8 months ago

Aron-Spiess started a new conversation How To Pass {id} From Url To Controller

I'm trying to write my query to use {id} from the url. Here's my controller

class MetricsController extends Controller
{
    public function metrics($id)
    {   // get common tiles cost incident fulfillment etc
        $metrics = Metric::selectRaw('url')
            ->where('tile_id', $id)
            ->get()   
            ->toArray();

        return view('dashboard.metrics', compact('metrics'));
    }
}

Lastly, since it's just one record that returns, can I change ->get() to ->first() and how do I return it in my view {{$metrics->'url'}}

Aron-Spiess left a reply on My Links Only Work When I Have Index.php Included In The Address.

updated last post, it's "server/sub_folder/laravel/public"

I could not find mod_rewrite in the httpd.conf file

Aron-Spiess left a reply on My Links Only Work When I Have Index.php Included In The Address.

this is what's in there

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Aron-Spiess started a new conversation My Links Only Work When I Have Index.php Included In The Address.

My links only work when I have index.php included in the address. my server is running apache

http://server.com/index.php/dashboards/1  -- working
http://server.com/dashboards/1  -- not working

Aron-Spiess left a reply on Having Trouble Understanding Routes And Views

capitalization was the issue, thank you. One other quirky thing... my links only work when I have index.php included in the address.

http://server.com/index.php/dashboards/1  -- working
http://server.com/dashboards/1  -- not working

Aron-Spiess left a reply on Having Trouble Understanding Routes And Views

@roman.gutkin: when I click the link, I get "View [dashboard.Dashboards] not found."

Aron-Spiess started a new conversation Having Trouble Understanding Routes And Views

I'm trying to link to views that are inside a folder.

example link from my leaders.blade.php onClick="window.location.href='{{route('Dashboards', ['id'=>$key])}}

Here's my views folder: -->views --> -->dashboard --> -->leaders.blade.php --> -->dashboards.blade.php --> -->metrics.blade.php

here's my web.php // get dashboard view i.e. cost, incident Route::get('dashboards/{id}', function () { return view('dashboard.Dashboards'); })->name('Dashboards');

// get metric view i.e. cost per ticket, custom Route::get('metrics/{id}', function () { return view('dashboard.Metrics'); })->name('Metrics');