cemcminn

cemcminn

Member Since 5 Months Ago

Experience Points 5,240
Experience Level 2

4,760 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 43
Lessons
Completed
Best Reply Awards 1
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.

23 May
1 day ago

cemcminn left a reply on Questions About Practical Validating/Sanitizing Solution(s)

@JLRDW - Great info! I need this info for a few other things.

My issue won't be HTML sanitizing input so much as just validating/sanitizing normal business data entry (from both public and administrators). I found waavi/Sanitizer. I plan to use it for the base sanitizing, but it looks like I will have to add a couple of custom items -- however, that part looks fairly painless in the samples on the github page.

Thank you!

cemcminn left a reply on Questions About Practical Validating/Sanitizing Solution(s)

@SNAPEY - @snapey Lol! I finally figured that out and I am hoping I can keep the naming schema to something similar to the Controller(s) names it may be assigned to.

For those who may be searching for this in the future, on your 'Insert' and 'Update' methods, make sure you type hint your parameter to the same name as your Request file. In other words, you might normally type hint to 'Request $request', now it will be something like 'MyControllerRequest $request' (if 'MyControllerRequest' is what you named your Request class). It's in the instructions - it just took me a bit of time to get there and find it.

22 May
2 days ago

cemcminn left a reply on Questions About Practical Validating/Sanitizing Solution(s)

Ok. I just went to research 'best ways to make/use helper files in Laravel'. I had several really good helper files in my native PHP code base but I feel like that now I am trying to learn Laravel, I need to question everything again to learn the 'best' way to do things (hence all the questions).

So how do you access the helper files? In the routes file closure or as a trait or something else?

Thank you again.

cemcminn started a new conversation Questions About Practical Validating/Sanitizing Solution(s)

  1. If I use a class created with 'php artisan make:request' to record my validation rules, am I able to only have one 'request class' in my project? If not, I can't find the right idea how to make multiple request classes to handle my various resource controllers. How is this usually done?

  2. Now the part of my question that relates to sanitizing inputs (with filter_var):

I saw a sample where someone added a sanitize method as a separate method in the request class and then validated the sanitized data with the 'rules' after it was sanitized. Is this a preferred method in Laravel?

Thank you.

08 May
2 weeks ago

cemcminn left a reply on .htaccess And Shibboleth Protecting Only Certain Directories

Follow up to this for those looking later:

  1. I got a virtual host file for my items (at least we are testing this idea).
  2. Using my existing authorization system to test against.
  3. Set up named middleware that I call in the web routes file using a convention similar to this one:
Route::group(['prefix'=> '/privatedirectory', 'middleware' => 'namedMiddleware:authorizationcheck'], function()
    {

...where the Middleware checks a particular authorization code to either allow entrance or not. Once I take the application to production, it will perform some more sophisticated rerouting in the middleware, but for now in test it just provides a "Not authorized" message.

29 Apr
3 weeks ago

cemcminn started a new conversation .htaccess And Shibboleth Protecting Only Certain Directories

My IT team got me started with the basic Shibboleth commands I need to protect everything under the Laravel 'public' directory, but I can't figure out how to protect only parts of it.

For instance, if I have directory abc and subdirectory abc/admin, I would only want to protect the items in abc/admin because anything outside of it would be public. I have tried adding .htaccess files to the views directories (because I couldn't think of anything else) and as expected it didn't work, of course, because those aren't the real 'files' (right?).

Where do I put these directives or do I need multiple 'paragraphs' in the Laravel public directory .htaccess file to protect certain parts of the project? If that is the answer, then I think I may have to go back to the IT team and make sure I have the ability to define such things because I have yet to make them work with .htaccess paragraphs.

Thank you!

15 Mar
2 months ago

cemcminn left a reply on Laravel-snappy And Many Different Views

@screenbeetle Thank you for your reply. Once I got a little further, I was going to post the only solution I found so far unless someone has a cleaner idea:

The various letters use different sets of data that do not cleanly build relationship models (my meaning of the word 'table'). Of course, this was fine as long as I used appropriate routing 1 set of data per letter, etc.

However, this won't really work for building the PDF using the tutorial as I don't want to send model names (?) or anything else like it across the post to get the various sets of required data.

So what I have decided to do is:

  1. Have two versions of each letter (primarily because you have to use 'public path' for the pdf version and URL::asset for the html assets -- no, I couldn't figure out why:-)).

  2. On the html version, add a 'noPrint' (@media css query) div to display a 'download pdf' button similar to this sample:

Download PDF ```
  1. Then, in the appropriate controller, build a data set that compiles the necessary set of resources for a group of the letters using an implementation similar to this method:
 public function generateReportPDF(Request $request)
    {

       $data = ModelName::find($request->id);
        $data = array('model name' => $data);

        if($request->has('download')) {
            $html = view($request->view, $data)->render();

            $snappy = \App::make('snappy.pdf');
            return response(
                $snappy->getOutputFromHtml($html),
                200,
                array(
                    'Content-Type' => 'application/pdf',
                    'Content-Disposition' => 'attachment; filename="' . $request->name .'.pdf"'
                )
            );
        }


        return view($request->view, $data);

    }

Any advice is appreciated.

Thank you again.

13 Mar
2 months ago

cemcminn left a reply on Laravel-snappy And So Many Different Letters You Wouldn't Believe It

OK, tomorrow I plan to try using DB and stored procs to load the data for each view (maybe I will make an array of which procs to use with which views?).

What do you think?

cemcminn left a reply on Laravel-snappy And So Many Different Letters You Wouldn't Believe It

Ok, 1st idea: I found the 'render' method (from the View class).

cemcminn started a new conversation Laravel-snappy And So Many Different Letters You Wouldn't Believe It

I have an entire directory of letters (with data) that I have made into views. My plan was to use the tutorial @laravelcode.com to build a generic Controller that would process any view I want to send to it:

https://laravelcode.com/post/html-to-pdf-in-laravel-using-barryvdh-laravel-snappy

My current code (I have removed the 'data search pieces' at present)

class PdfGenerateController extends Controller
{
    public function pdfview(Request $request)
    {
        if($request->has('download')) {
            // pass view file
            $pdf = PDF::loadView('emails.app_ack.index');
            // download pdf
            return $pdf->download('app_ack.pdf');
        }
        return back();
    }

}

The tutorial shows building the data from one source by finding it again in the above method call and it works for the first document I tried, but I won't always need just that one table. Any thoughts on how I might pass in all the data I need from the view so that it builds any page I might ask for?

Would it be better to use the 'wrapper' method and perhaps create 2 versions of each page (one for display and one for pdf download?)

Am I completely on the wrong path?

Thank you.

25 Feb
2 months ago

cemcminn left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

@roborobok In my legacy code, I composed and return the drop-downs (select lists) in the class method and passed in the desired field name, currently selected value if appropriate, etc.

It sounds like your idea would be the closest match to that approach.

21 Feb
3 months ago

cemcminn left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

@ROBOROBOK - How would you pass it to any view that needs it? ie, would I need to pass in a parameter in to say "provide for view1", for instance?

Thank you.

cemcminn left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

I will often have multiple fields on a page that refer to the countries, for example. Nationality, mailing country, residence country, etc.

Also my 'main' will be different for each subset of my system. In other words, I will have mains/sub pages for departments 1-15 or perhaps they are divided by process, etc.

Would this change your answer, @roborobok?

20 Feb
3 months ago

cemcminn left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

Worked beautifully. ...And I answered my own question. Yes, you can put multiple things in 'boot', so I added 'countries' and I had already added:

\URL::forceScheme('https');

Thank you again, @shahrukh4 .

cemcminn left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

@SHAHRUKH4 - Great!

And I saw this area and have another question: If I have multiple things that should go here (like 'countries' or 3rd Party libraries), I can add more than one thing in the boot method, correct?

Thank you! I will try it out.

19 Feb
3 months ago

cemcminn started a new conversation System Values

I am developing my first project. Things are going fairly well, but now I think I have missed a concept:

I have a 'person' model (defined relationship: hasOne state in the model).

I have a 'program' model (defined relationship: program hasOne person in the model).

I have a 'states' table (and a State model) that I want to use in quite a few locations (later when I begin to convert all my legacy code to the Laravel project), so I would like to create a partial view containing a drop down list of the states so that I can match the person's state with the value from the 'list table' of states.

What is the best way to make this code generic so that it can be used anywhere and feed (in this case) the person's state into the logic so that on my view where I am using the ProgramController I can have a drop down list of states and match the "selected=selected" attribute to the correct value?

I thought of adding the code to my Program controller as a method (State::get()), but realized it certainly won't be generic to use anywhere the 'state' drop down needs to be displayed.

Thank you.

11 Jan
4 months ago

cemcminn left a reply on Converting Mysql To Laravel Query

Do you maintain your own database? If so, is it mySQL?

cemcminn left a reply on Converting Mysql To Laravel Query

Here is a stack overflow article:

https://stackoverflow.com/questions/34497063/how-to-execute-stored-procedure-from-laravel

I will go back through my reference material and see if I can find a tutorial for you.

cemcminn left a reply on Converting Mysql To Laravel Query

Why would you not want to do something that detailed as a stored procedure?

Example:

DB::select('exec my_stored_procedure(?,?,..)',array($Param1,$param2));
10 Jan
4 months ago

cemcminn left a reply on Advanced Database Searching (Ad Hoc Querying)

I looked at Scout. I don't see that does anything other than full-text searching. Am I missing something?

09 Jan
4 months ago

cemcminn left a reply on Advanced Database Searching (Ad Hoc Querying)

@JLRDW - Thank you! Scout looks like something I should perhaps look into. My goal is to allow a flexible query building process on as many of the fields as possible. Translation: Not so much coding and more dynamic -- especially if if I add new fields down the road.

Before I decided to use Laravel, I had actually almost built something using MySQL schema info tables and the comment field. Here is a snippet or two:

Array to hold comparison types:

private $operators_arr = ['='=>'equals', '!='=>'not equal to', '>'=>'greater than', '>='=>'greater than or equal to', '<'=>'less than', '<='=>'less than or equal to', 'like'=>'like', 'like'=>'begins with', 'contains'=>'contains'];

Array to hold form field types (html):

private $answer_type_arr = ['textbox'=>'1', 'datepicker'=>'3', 'yn_bit'=>'4', 'dd_specific'=>'5'];

Then in the comments of the field, I planned to add 'Field Label|1' -type conventions for those fields which should be searchable.

I built stored procedures to access the table/column information that started something like this:

select concat(table_name, '.', column_name) as column_name, column_comment from information_schema.columns where (table_name like ...) and COLUMN_NAME not in (place to leave out columns that are not to be searched) or COLUMN_NAME not !=;

Then I had built a form that could be hidden and displayed on the management page and additional rows added as needed (with a plus sign button type design) to build the search parameters for the search.

I think Scout may be infinitely easier, however :-) Thank you for your response.

08 Jan
4 months ago

cemcminn started a new conversation Advanced Database Searching (Ad Hoc Querying)

I am developing my first Laravel Project.

The project that I will be building is a web version of a FileMaker legacy system.

In FileMaker, the user is able to search all fields included on the layout in order to display the accounts he/she wants to work with. The database is quite complex with at least 7 to 8 data tables with many fields to maintain for each account (I would say there is 200+ in all). I would prefer to build a search panel -- I do not relish the idea of having search and edit in one set of fields -- unless that is part of Laravel that I need to embrace :-)

I am looking for a design pattern to follow that might be most effective in a case like this in Laravel.

I found this github project: https://github.com/amochohan/advanced-eloquent-search-filters

Is this probably my best route? Anyone else have another suggestion for a design pattern/search setup I should pursue?

Thank you!