In most case, we want to extend our Laravel applications capabilities by adding helper class.
It is not a best practice to insert this classess inside Controller and Model.
so we have to write our classess in separate files and group it by folder
Here let us have a look how we add helper classess in laravel
1. We have app folder on root folder of laravel.There we can create a Libraries folder inside app folder.
2. We can create a class/helper file and we can write a our custom class there, on the top of custom class we have to define namespace our_folder_name;
namespace our_folder_name
for example ,
//here my folder name is Libraries
namespace Libraries;
class className{
//class methodes
}
Now we can go to our controller and on top we can include our helper class
use Libraries\filename as filename;
And we can go to compser, inside autoloder we can add “app/foldername”
All my samples files are given below
Library/className.php
<?php
namespace Libraries;
class className{
//class methodes
function testmesthode(){
return "Hello world";
}
}
testController.php
<?php
use Libraries\className as className;
class testController extends BaseController {
function index(){
$test = new className();
echo $test->testmesthode();
}
}
Today i was trying to install laravel in MAMP , While going through their step on laravel site mentioned i found that i didn installed mycript extension. I had googled for lot of time and lastly i installed .
I am writing this will help some one to install laravel in Mac using MAMP.
Install composer
Before installing laravel we have to install composer . We can go to https://getcomposer.org/ and we can install from from there or we can follow the following steps step
1. first we have to check curl is enabled . step 2. we can install composer globally as mentioned in their site
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
0 px
Now Let us look a demo with window object ,
Enter a value to scroll top
Now letus look scrollTo with animations
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
0 px
Now Let us look a demo with window object animated ,
Enter a value to scroll top
Today i saw some interesting hidden features in Mac, Which most of them not using. Here i am giving which i like to use with short keywords.
-Take a Full screenshot
You can holding down command + shift + 3 to take the complete screenshot of your mac
if you want to save it copy board, can holding down command + ctrl + shift + 3
– Part of screen
For taking screenshot of a special part of screen you can holding down command + shift + 4 Then cursor will change to + and can drag where you want to take screenshot. It will be saved in folder (Desktop by default).
if you want to save it copy board, can holding down command + ctrl + shift + 4
– Spotlight search
you can holding down Command + Spacebar to show Spotlight search, type and search on your mac an internet.
– Apple symbol
On any Apple computer, you can create an Apple icon by holding down Option + Shift + K, It will create a apple symbol like this 😉
Apple_symbol from mac
– Built-in Mac emoticons
On mac we can use emoticons by simply holding down ctrl+⌘+space . it will appear a box of emoticions.
mac-emotions
– Quick preview with spacebar
We can quick preview any file by selecting the file and pressing the spacebar. Press the space agin it will auto close. On menu you can see compatible apple also .
Here we are going to write a regular exprestion for Password to check the condition like , password must contain at least one number,one capital letter and one special character.
This will check the string contain at at least one number,one capital letter and one special character,
Here i am going to show examples with Javascript function ,
We can write a function in javascript as below
function validatePassword(str)
{
// patter to match : Atleast one number ,one capital letter, one special charector
var reg = /^(((.*\d.*[A-Z].*[!@#$%^&amp;*? ~].*))|(.*[A-Z].*\d.*[!@#$%^&amp;*? ~].*)|(.*[!@#$%^&amp;*? ~].*[A-Z].*\d.*)|(.*[!@#$%^&amp;*? ~].*\d.*[A-Z].*))$/;
if (reg.test(str)) {
return true;
}
else {
return false;
}
}
and we can pass the string as function argument “str”, It will return if it matches the condition else it will return false.
To allow integer only in text field we can use the following jquery function .
We can write below code inside a document.ready function and give the class “integer-allowed” for the text box we needed.