Park.
http://www.game-debate.com/games/index.php?g_id=5270&canMyGpuRunIt=Blender
Another Kuantan Blogger
Park.
http://www.game-debate.com/games/index.php?g_id=5270&canMyGpuRunIt=Blender
Adding div below primary navigation
add_action( 'genesis_before_content_sidebar_wrap', 'feature_my_single_post_image' ); function feature_my_single_post_image() { if( is_singular( 'page' ) ) { global $post; $size = 'full-size'; $default_attr = array( 'class' => "aligncenter attachment-$size $size", 'alt' => $post->post_title, 'title' => $post->post_title, ); printf( '<div class="example">%s</div>', genesis_get_image( array( 'size' => $size, 'attr' => $default_attr ) ) ); } } add_image_size('panoramic', 1140, 199, TRUE); add_filter( 'image_size_names_choose', 'my_custom_image_sizes_choose' ); function my_custom_image_sizes_choose( $sizes ) { $custom_sizes = array( 'panoramic' => 'Panoramic', ); return array_merge( $sizes, $custom_sizes ); }
Credit: https://www.organicweb.com.au/17445/wordpress/genesis-move-featured-image/
List all
diskutil list
Mount disk
diskutil mount /dev/disk2s1
Umount
diskutil unmount /dev/disk2s1
There is a lot special functions that helps simplified our code like this
find($id)
takes an id and returns a single model. If no matching model exist, it returns null
.findOrFail($id)
takes an id and returns a single model. If no matching model exist, it throws an error.first()
returns the first record found in the database. If no matching model exist, it returns null
.firstOrFail()
returns the first record found in the database. If no matching model exist, it throws an error.get()
returns a collection of models matching the query.lists($column)
returns a collection of just the values in the given column.toArray()
converts the model/collection into a simple PHP array.Looking for more? Visit here or https://laravel.com/docs/5.3/eloquent-collections.
Sentinel::RegisterAndActivate()
//Register the $request user and activate if(Sentinel::registerAndActivate($request->All())){ //Search the new registered user $user = User::whereEmail($request->get('email'))->firstOrFail(); //Bind the user to Activation Table $activation=Activation::create($userSentinel); //Assign A Profile To The New Registered User $userProfile = new Profile(); $userProfile->user_id = $user->id; $userProfile->smoked = $request->smoked; $userProfile->lat = 0.0; $userProfile->lng = 0.0; $user->profile()->save($userProfile); //Find role $role=Sentinel::findRoleBySlug('member')->firstOrFail(); //Attach the user to the Role $role->users()->attach($user); return redirect()->back()->with('status','Registration Successful !'); }else{ return redirect()->back()->with('error','Registration Failed !'); //return back()->withErrors($validator); }
Sentinel::Register()
if($userSentinel = Sentinel::register($request->All())){ //Search the new registered user $user = User::whereEmail($request->get('email'))->firstOrFail(); //Bind the user to Activation Table $activation=Activation::create($userSentinel); //Assign A Profile To The New Registered User $userProfile = new Profile(); $userProfile->user_id = $user->id; $userProfile->smoked = $request->smoked; $userProfile->lat = 0.0; $userProfile->lng = 0.0; $user->profile()->save($userProfile); //Find role $role=Sentinel::findRoleBySlug('member')->firstOrFail(); //Attach the user to the Role $role->users()->attach($user); return redirect()->back()->with('status','Registration Successful !'); }else{ return redirect()->back()->with('error','Registration Failed !'); //return back()->withErrors($validator); }
Middleware is a class that have special function in Laravel.
Middleware placed in between the User and Apps.
Before you can access the Apps, Middleware will do his job first.
We can use Middleware to do several thing
class MemberMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { //1. User must be authenticated //2. User must should be a "member" if(Sentinel::check() && Sentinel::getUser()->roles()->first()->slug == 'member') return $next($request); else return redirect('/login')->withErrors('Please login to access this area.'); } }
Another example
class ProfileMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { 1. Get Profile Id 2. Get Profile User Id 3. User must own the Profile //$ProfileId = $request->segments()[1]; //boleh pakai //$profileId= Profile::find($this->route()->parameter('profileShow')); $ProfileId = $request->route()->parameter('id'); //boleh pakai $profile = Profile::findOrFail($ProfileId); if ($profile->user_id !== Sentinel::getUser()->id) { // dd($request->user()->id); // abort(403, 'Unauthorized action.'); // return redirect('/profile')->withError('Permission Denied'); return redirect()->back()->withErrors('Permission Denied!'); } return $next($request); } }
Another finest!
class ProfileMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { //get User Id $UserId=$request->id; //get User Profile $profile=Profile::whereUserId($UserId)->first(); if ($profile->user_id !== Sentinel::getUser()->id) { return redirect()->back()->withErrors('Permission Denied!'); } return $next($request); } }