engrlaravel

engrlaravel

Member Since 9 Months Ago

Experience Points
2,480
Total
Experience

2,520 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
1
Lessons
Completed
Best Reply Awards
0
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 1
2,480 XP
Oct
21
3 weeks ago
Activity icon

Replied to Laravel Cron Jobs/ Task Scheduling

@sinnbeck : what is best way to create laravel scheduling? there are many ways which is confusing.

Example: Closure & Commands

Activity icon

Started a new Conversation Laravel Cron Jobs/ Task Scheduling

I am using IIS server to run laravel website. How i can create task scheduling on windows IIS server?

On linux server it is asking to run this commond, but how to do in window?

          • cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Oct
20
3 weeks ago
Activity icon

Started a new Conversation Redis Vs Memcached In Laravel

I want to implement cache in laravel. Which one should i pick? Redis or Memcached?

I know this is very common question, but still it is not clear.

I read complete details on internet but its still confusing. I will consider speed & storage.

Oct
13
4 weeks ago
Activity icon

Replied to Laravel - Access Denied Issue

I do not know what was the issue with root. I created new user with % as host and its working fine

Activity icon

Replied to Laravel - Access Denied Issue

@geowrge : Please note, i created one php file outside laravel application and test connection. i can connect to DB with same credentials

Activity icon

Started a new Conversation Laravel - Access Denied Issue

I migrated my PHP website to Windows server IIS. Now i am getting this error

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

Here is my .env file details

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydbname
DB_USERNAME=root
DB_PASSWORD=mypwdhere

I also clear config by command

php artisan config:clear

I am using mysql workbench 8 & accessing directly like http://localhost/myapp/admin/login

what can be the issue?

Oct
09
1 month ago
Activity icon

Started a new Conversation Avoid Application Crash In Laravel

In laravel, if there is any error or bug, it crash the application and showing black error code screen.

How can i show some user friendly page to user if there is any crash or error?

Sep
30
1 month ago
Activity icon

Replied to Add Dynamic Prefix In Laravel Routes Web.php

@mikemacdowell : Then what is the best way to do it?

Activity icon

Replied to Using Cache In Laravel

@sti3bas : thank you for your reply.

I can see this on documentation "Predis has been abandoned by the package's original author and may be removed from Laravel in a future release."

So what alternative we should use?

What about mencached? how that can be configured on server?

Activity icon

Replied to Using Cache In Laravel

@sti3bas : Once Redis is installed, what extra changes/configurations do i need on laravel & DB side?

Also for Memcached, do i need to install on server?

Activity icon

Started a new Conversation Using Cache In Laravel

I am using laravel 5.8. I know laravel support memcached & redis. If i go for Redis, what should i do? Do i need to buy something for my hosting??

How to get these values?

'redis' => [

'client' => 'predis',

'default' => [
    'host' => env('REDIS_HOST', '127.0.0.1'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', 6379),
    'database' => env('REDIS_DB', 0),
],

'cache' => [
    'host' => env('REDIS_HOST', '127.0.0.1'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', 6379),
    'database' => env('REDIS_CACHE_DB', 1),
],

],

I am new to it. Can anyone explain step by step what should i do?

I have doubt i should buy/configure on my hosting as well? do i need to buy server for it?

Activity icon

Replied to Add Dynamic Prefix In Laravel Routes Web.php

@mikemacdowell : Simply, I just want to create url having each company name who is using my application( who is registered with me).

For example, If you are login(assume your company name is mikemacdowell) so the route will be example.com/mikemacdowell/.....

and if i am login(company name is laravel) so example.com/laravel/......

Activity icon

Started a new Conversation Add Dynamic Prefix In Laravel Routes Web.php

I have below code example in my web.php

Route::group(['prefix'=>'admin'],function (){

Route::group(['prefix' => 'admin','middleware' => 'auth'], function () {

Route::group(['prefix' => 'candidate','middleware' => 'auth'], function () {


Route::get('login', 'frontend\[email protected]');

Route::get('/home', '[email protected]')->name('home');

I have some group & some with out groups.

Questions:

1- How to get dynamic value from DB

2- How i can add that value prefix before all above?

Example

example.com/company_name/admin

example.com/company_name/home
Sep
25
1 month ago
Activity icon

Started a new Conversation Workflow Process Design & Automation With Web Forms In Php - Laravel

Is there any PHP / Laravel workflow generator, same as https://www.workflowgen.com/ in DOTNET?

Sep
24
1 month ago
Activity icon

Replied to Laravel Eloquent JOINS & Relationships Issue

@tisuchi : I have tried below

public function vacancies()
{
   return $this->hasManyThrough('App\Vacancy', 'App\PlanPosition','plan_id','position_id','','position_id');
}


and now it is working
Sep
23
1 month ago
Activity icon

Replied to Laravel Eloquent JOINS & Relationships Issue

@tisuchi : thank you for your answer.

I have only this relation

public function positions()
{
 return $this->hasMany('App\PlanPosition', 'plan_id');
}

Can you tell me what relationship should i have between PlanPosition & Vacancy? Both tables have position_id

Activity icon

Started a new Conversation Laravel Eloquent JOINS & Relationships Issue

I have below tables/models

Plan(id,created_by)
PlanPosition(id,plan_id,position_id)
Vacancy(id,position_id)

I have this relation in Plan

public function positions()
{
    return $this->hasMany('App\PlanPosition', 'plan_id');
}

Now i want to do the following

 select all records from first 2 tables where plan.created_by = 7

AND

AND is not exist in vacancy

Is there any cleaner way to do it in laravel?

Sep
22
1 month ago
Activity icon

Replied to Relationship With Many Where Condition

@mstrauss : your approach is much cleaner. what about this one?

    Interview::where('created_by',Auth::user()->id)->where('company_id',Auth::user()->company_id)
                ->orWhereHas('attendees', function ($query) {
                    $query->where('interviewer_id', Auth::user()->id);
                })->get();
Activity icon

Started a new Conversation Relationship With Many Where Condition

I have below tables/models

Interview (id,subject,created_by)
InterviewAttendee(id,interview_id,interviewer_id)

Here is my relationship to get attendees for any interview

   public function attendees()
{
    return $this->hasMany('App\InterviewAttendee', 'interview_id');
}

Now i want to select all interview (interviews table) which satisfy any of below conditions

 1- Auth::user()->id = interviews.created_by
 2- Login user has role = "HR"
 3- Auth::user()->id  = InterviewAttendee.interviewer_id

Can anyone suggest how to do it smoothly?

Sep
16
1 month ago
Activity icon

Started a new Conversation Best Way To Stop Users Directly Access Url

I am using below package in laravel

laravel-permission

If user is login, He can access links of different roles not assigned to him. The only two ways to stop him is

public function __construct()
{
    $this->middleware(['role_or_permission:Admin|HR|HRM']);
}

OR

Route::group(['middleware' => ['role_or_permission:super-admin|edit articles']], function () {

Now the problem is, what if new role or permission created which is not mentioned here??

also you can not mention a long list of roles & permissions one by one.

Is there a better way?

Activity icon

Replied to Best Way For Sub Apps In Laravel

@martinbean : Yes, till this point is clear. The issue is how we handle company slug in url prefix?

Currently i have below groups in web.php

Route::group(['prefix'=>'admin'],function (){
Route::group(['prefix'=>'candidate'],function (){

Currently my url is

example.com/admin

I need to change to

 example.com/apple/admin
 example.com/apple/candidate

How to prefix company slug ?

Sep
15
1 month ago
Activity icon

Replied to Stop Users Access Your Pages Directly From Url

@flightsimmer668 @snapey :

1- I did something like this

 @role('HR')
  //show menu links of HR
 @endrole

Above code working fine and showing HR menu only to HR role.

2- Now if a person is login and has link of any other page, he can access that without menu links directly from browser.

Issue: I guess i can not put

if (auth()->user()->hasRole('admin')) {
    return $next($request);
}

in middle ware as there is more than 10 roles not only admin.

Activity icon

Replied to Stop Users Access Your Pages Directly From Url

@flightsimmer668 : There is some misunderstanding. If user has session(he is logged in in other tab), he can directly access other pages from link.

I need to check on role not login user.

Your answer only show for login or not

Activity icon

Started a new Conversation Stop Users Access Your Pages Directly From Url

I am using laravel package laravel-permission. I have put checks on menu for different roles & permissions.

BUT now users can access directly from url.

What is the best way to stop all users access from url & apply roles & permissions?

Note: I want to check role & permission NOT Login(if user is Auth or no)

Activity icon

Started a new Conversation Load Data Which Is Available In Layout File On Each Link/url

I want to show some notifications on header layout file. This data should be available on each link/URL.

what is the best place to get this data & how to pass ?

Sep
13
1 month ago
Activity icon

Replied to Best Way For Sub Apps In Laravel

@martinbean : I liked your suggestion above. I am following that way to do. I am stuck how i can change customer name to my url.

For example, If martinbean is my customer's company & he access my application, url link will be changed automatically after login for him as below

example.com/martinbean 

If APPLE is my customer so after login his url will be

example.com/apple
Sep
11
2 months ago
Activity icon

Replied to Best Way For Sub Apps In Laravel

@martinbean : Can you please explain little more, how i can change url based on customer?

Example:

example.com/customer1
example.com/customer2
Sep
10
2 months ago
Activity icon

Replied to Dynamically Change Url For Each Customer In Laravel

@resin : How i can do it? Can you share some links?

Activity icon

Replied to Best Way For Sub Apps In Laravel

@sti3bas : I think this will be more complicated for me? i guess that need more time & configurations and i am affraid it will effect my other work. I will see if i can find another easy way

Activity icon

Started a new Conversation Dynamically Change Url For Each Customer In Laravel

I am using Laravel 5.8.

Suppose my website is www.example.com. If customer register company1 , He & all company users will see url like

www.example.com/company1

Another customer register company2, his all users will see

www.example.com/company2

How i can achieve this dynamically?

By Default, i have below groups

Route::group(['prefix' => 'admin','middleware' => 'auth'], function () {

Route::group(['prefix'=>'admin'],function (){

Route::group(['prefix'=>'candidate'],function (){

and others

Activity icon

Replied to Best Way For Sub Apps In Laravel

@martinbean : WOW, very good idea. Can you give me little more explanation or document link? also how to load customer routes? what if i want to use the same routes BUT only customer name is different?

Activity icon

Replied to Best Way For Sub Apps In Laravel

@cruorzy : what is the best option to do it? will subdomain will be ok or www.example.com/randomstring??

If we can handle all this in one instance then ok otherwise we will upload separate website

Sep
09
2 months ago
Activity icon

Started a new Conversation Best Way For Sub Apps In Laravel

I have developed my website in laravel 5.8 and is deployed on www.example.com It is SAAS application.

Now my client want to give different url for each customer(we will have more than 200 customers).

what is the best way to handle it?

my idea is to create folders (customer1,customer2...) inside laravel and re-upload whole application in each folder?

Note: we already have some groups in routes like www.example.com/admin, www.example.com/candidate etc

Your idea will be appreciated

Sep
02
2 months ago
Activity icon

Replied to Wechat Login In Laravel Website

@sti3bas : Now Issue is it redirects to provider(like wechat). is there anyway it can login without sending users to proviers

Activity icon

Started a new Conversation Create Dynamic Menu & Menu Items In Laravel

Is there any good practice to create menu dynamically. all menus should be followed by specific roles. How the menu & its links should work?

Activity icon

Replied to Wechat Login In Laravel Website

@sti3bas : I am confused which one should i use? Wechat web/weixin/weixin web?

Activity icon

Started a new Conversation Wechat Login In Laravel Website

I have admin application developed in laravel. I want users to login through wechat. Is there any package which support wechat login? i checked this https://github.com/overtrue/laravel-wechat but it give some issues.

Does anyone tried any package for wechat login?

Activity icon

Started a new Conversation Laravel - Roles & Permission In SAAS

Laravel roles & permission package (laravel-permission) is working fine in application for single company. How we can use it for multiple companies(more than one company)?

1- each company has different users

2- each company has different roles

3- each company has different permission for each role(might be possible)

4- laravel application is same for all companies & hence DB

Sep
01
2 months ago
Activity icon

Started a new Conversation Checking Both Roles & Permission At The Same Time

I am using laravel-permission package. I want to show HR menu only to HR & Admin roles and who has permission to HR menu.

 @role('HR|Admin')
<a href="{{ url('hr') }}">HR Menu</a>
 @endrole

How i can combine permission to above condition?

permission alone i can use like this

@can('edit articles')
  <a href="{{ url('hr') }}">HR Menu</a>
@endcan
Aug
29
2 months ago
Activity icon

Replied to Laravel Permission Package Issue

@janosk : it always go to else statement

Aug
28
2 months ago
Activity icon

Started a new Conversation Laravel Permission Package Issue

I am using this package

laravel-permission

Below code is not working

@hasrole('writer')
I am a writer!
@else
 I am not a writer...
@endhasrole

while this is working

@if($user->hasRole('writer'))

Is there any issue? Has I missed something?

I am following this link https://docs.spatie.be/laravel-permission/v2/basic-usage/blade-directives/

Aug
26
2 months ago
Activity icon

Started a new Conversation Replace All Parameter Variables With Values In String Templates

I have templates for emails, I want to replace all occurrences with variable values in the template. Example:

$template = <p>Hi {applicant_name},</p>
            <br>
            <p>You are welcomed to {org_name}</p>, Your salary is {salary}
            <br>
            <p>
            -<br>{company_name}</p>

I have

 $applicant_name = "John";
 $org_name  = "ITF";
 $salary = 50000
 $company_name = "ABC"

How i can do it in laravel with a single function? I want to replace template of variables with real variable names.

Activity icon

Replied to How To Check If Variable Is Empty/null/NULL/not Set/0

@petrit so what is a combine expression or function who can handle all these cases?

Activity icon

Replied to How To Check If Variable Is Empty/null/NULL/not Set/0

@tisuchi : some time it comes from user form, some time in my function. i want to do it in php server side, it is not validation.

is there any function?

Activity icon

Started a new Conversation How To Check If Variable Is Empty/null/NULL/not Set/0

I know there are many ways like

empty($var)
is_null($var)
isset($var)
if(!$var)

But each one has different purpose. I want to have a combined function in laravel to check all these

Does laravel provide a single function to check all in one?

Need to check all possible like

NULL,null,'',0, undefined , not posted and others
Aug
14
2 months ago
Activity icon

Started a new Conversation Using UUID Also Keeping Id As Well In Laravel

I have users table with Id primary key. I do not want to change / alter users table but add one more field as uuid and allow users to login based on it. is it possible?

1- is it possible to have both Id (primary key and auto increment) and uuid?

2- can i use uuid in anyother table? other than users table?

3- If we add uuid field as well, will it be possible to login user with that?

Activity icon

Replied to Multiple Emails In Laravel

@bobbybouwmann I got few questions:

1- When user click button, he has to wait till all emails sent? or it will be done in background?

2- Will it slow down the website? user can freely browser other functions?

3- Can i use scheduling? https://laravel.com/docs/5.8/scheduling

4- which one is better option? scheduling or queue?

5- Queue can be used with MySql?

Activity icon

Started a new Conversation Multiple Emails In Laravel

In my SaaS application, I want to send email to more than 20 users at one button click. First i save data in DB and then sending them emails. Currently i am using laravel builtin function. It takes too much time.

   Mail::send

What is the best option to send multiple emails? any suggestions?

1- Do i need to create cron jobs to send emails?

2- Do i need to use any third party tool like mail gun or mail chimp?

3- Do i need to use anyother laravel Queue functionality in larave;?

4- anyother suggestion?

Aug
04
3 months ago
Activity icon

Started a new Conversation Different Routes For Different Roles

Is it possible in laravel to use different route path for different roles?

For example:

role= candidate using this path
    Route::get('dashboard', 'DashboardC[email protected]');

role=admin can use this path
    Route::get('dashboard', '[email protected]');

in routes/web.php file

Aug
01
3 months ago
Activity icon

Replied to Roles & Permissions In Laravel Application

@Is there any example which showing how to implement laravel-permission? I am worried about, how to make flow or user front end to use/utilize this package