cemcminn

cemcminn

Member Since 9 Months Ago

Experience Points
5,890
Total
Experience

4,110 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
49
Lessons
Completed
Best Reply Awards
1
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
5,890 XP
Jun
24
3 months ago
Activity icon

Started a new conversation Card And Envelope Templates

I need to create a report for my user to print on two different non-traditional formats: 3x5 card size and envelope size for a 'set' of people (different instances). Does anyone know a place where I can see examples, etc., for sizing the pages appropriately for these kinds of 'reports'? I have imagined it in pdf format, but I am open to web pages that are easily printable, etc.

Thank you,

May
23
4 months ago
Activity icon

Replied to 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!

Activity icon

Replied to 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.

May
22
4 months ago
Activity icon

Replied to Questions About Practical Validating/Sanitizing Solution(s)

@jlrdw 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.

Activity icon

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 of 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.

May
08
5 months ago
Activity icon

Replied to .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.

Apr
29
5 months ago
Activity icon

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 "location" paragraphs.

Thank you!

Mar
15
6 months ago
Activity icon

Replied to 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:

<div class="noPrint">
    <a href="{!! route('generate-pdf-route_name',['download'=>'pdf', 'id'=> $model->id,
                                               'view'=>'view.name.index',
                                               'name'=>'name to use to save pdf file']) !!}"
       class="noPrint">Download PDF</a>
</div>



  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);  //******this is what I typically call 'table'
        $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.

Mar
13
7 months ago
Activity icon

Started a new conversation Laravel-snappy And Many Different Views

I have an entire directory of letters (with data) that I have made into views. My plan was to use the tutorial at laravelcode.com (link below) 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.

Feb
25
7 months ago
Activity icon

Replied to 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.

Feb
21
7 months ago
Activity icon

Replied to 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.

Activity icon

Replied to 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?

Feb
20
7 months ago
Activity icon

Replied to 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 .

Activity icon

Replied to How To Make List Values Available For Multiple Controllers (drop Down View)

@SHAHRUKH4 - Great!

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.

Feb
19
7 months ago
Activity icon

Started a new conversation How To Make List Values Available For Multiple Controllers (drop Down View)

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.

Jan
11
9 months ago
Activity icon

Replied to Converting Mysql To Laravel Query

Do you maintain your own database? I assume so if you wrote a query like that :-)

Generically, stored procedures are objects inside your database that allow you to name and run queries over and over without having to type them each time.

Here is a good generic page to get you started with what you should look into for learning how to write them:

https://www.w3schools.com/sql/sql_stored_procedures.asp

Note that each database engine has its own syntax for creating a stored proc so you will have to look at the documentation for your specific instance.

Database management tools like HeidiSQL have a sort of wizard that keeps you from having to create procs by typing the whole thing.

Activity icon

Replied to Converting Mysql To Laravel Query

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

Example:

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

Replied to 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?

Jan
09
9 months ago
Activity icon

Replied to 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 plus sign/minus sign buttons) to build the search parameters for the search.

Jan
08
9 months ago
Activity icon

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!