Monthly Archives: April 2017

Laravel Practice:

Till now  we have covered :
Laravel fundamentals that consists of
Routes:
Controller:
View:
Little bit of blade templating engine

Routes:

In route we route the link example:

Some route example including where method:

naming routes from edwin’s video:

Laravel Routing:
https://laravel.com/docs/5.4/routing

Controller:

To create controller with predefined functions we need php artisan command

This command will create automatic controller file name ZakiLive.php in

folder with predefined function.

Link Controller With Routes

So, we can set in routes/web.php file and link with controller by below code:

here index is a function/method that is exist in with ZakiLive.php  controller file

Passing data to controller from route:
in route/web.php file

Now in ZakiLive.php controller file in index method/function we are getting the id, name from the url route so the code of this function below:

So when we are typing:
http://cms.dev/post/99/jj

It is giving the output:
Hello! ID: 99name: jjfrom Zaki

Resources and Controllers:
By typing this in web.php route file:

Check we didn’t linked to any specific methods in ZakiLive controller file..This is the magic of resource function in laravel and then typing PHP artisan command from terminal we get:

 

 

Our main task is in:
routes folder where we can create naming routes for a page which plays role to redirect a page from web browser to view for the user using help of the PostsController.

Make a recipe for my working project:
In routes/web.php (aka routes.php) we need to add a line

 

Mission Laravel: PHP Artisan Command

TO get all registered list:

Create Controller:

Controller with resource:

Get All the URI from the function resource

 

Mission Laravel: Install Directory

VHOST Directory:

My Windows Directory:

 

Mission laravel: Installation

laravel installation:

example for me:

in this case laravel will install from the latest version

PHP OOP Project

Basic Simple Project By Me:

By Others:
From OOP Fundamentals udemy Video project:

 

Count number of 2’s in a given range (0 to n)? (ex: range between 0-20, Ans: 3 (i.e [2], 1[2], [2]0))

Google Search: https://www.google.com/search?q=Counting+2s&ie=utf-8&oe=utf-8&client=firefox-b#q=Counting+2s+in+c

SOlution: https://www.careercup.com/question?id=56794

 

PHP Regex

Regex Tutorial:

Best Site To Learn Tutorial

https://regexone.com/lesson/optional_characters (Will start from this page other pages completed before)

https://regexone.com/lesson/introduction_abcs

https://regexone.com/references/php

https://www.tutorialspoint.com/php/php_regular_expression.htm

 

example from regex one.com:

 

Mission Design Patterns

Frequency of Digit in A Number

code:

Ref: http://www.codeforwin.in/2016/10/c-program-to-count-frequency-of-digits-in-number.html

Logic to Find First and Last Digit

Last Digit:

First Digit:

 

 

String Frequency Count

code:
simple code:

good output:

Reference: http://www.codeforwin.in/2015/04/c-program-to-calculate-the-frequency-of-each-character-in-a-line.html

101cproblems.com solution:

 

 

String Palindrome Problem

My Own Logic:

Another logic:

Simple:

another good logic:

 

 

Count word

Problem from 101cproblems.com:
Write a program which will take a sentence as input and tell us how many words are there. [If user gives input “I love Bangladesh”, then the output should be: 3]

code:

 

String Problem: Uppercase to Lowercase, Lowercase to Uppercase

Problem 70: Case Fix

You are given a string mixed with uppercase and lowercase letters . Your task is to write a program which will
flip the letters : (UpperCase -> LowerCase, LowerCase -> UpperCase)

Example:
INPUT:        OUTPUT:

eLepHanT   Elephant

cAt                  Cat

SuNDAY       Sunday

code:

not upto the output yet:

beautiful code with exacts output:

 

 

String Problem: ASCII table related

Problem: Write a program which takes a string of alphabet as input and replace all the characters with the 3rd immediate character of it. All the alphabets of the input string will be small letter. [If user gives input “abc” you should print “def”, if user gives input “xyz” you should print “abc”]

mycode: