<file_sep><?php
namespace App\Actions\TicketType;
use App\Models\Ticket_type;

class UpdateTypeAction

{
    public static function execute($inputs,$slug)
    {
        $type=Ticket_type::where('slug',$slug)->FiRSTOrFail();

        $type->update([
       'name'=>$inputs->name
        ]);

        return $type;

    }

}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User_permission extends Model
{
    use HasFactory;

    protected  $fillable=['user_name','role_name','permission_name','project_id'];

   /* public function users()
    {
        return $this->belongsTo('App\User');
    }

    public function permissions()
    {
        return $this->belongsTo('App\Models\Permission');
    }


    public function roles()
    {
        return $this->belongsTo('App\Models\Role');
    }


    public function projects()
    {
        return $this->belongsTo('App\Models\Project');
    }*/


}
<file_sep><?php
namespace App\Actions\Log;

use App\Models\Project_activity;

class  ProjectActivityAction
{
    public static function execute($user_name='',$action_type='',$project_id=null,$property=[])
    {
        $proactivity=Project_activity::create([
            'user_name'=>$user_name,
            'action_type'=>$action_type,
            'project_id'=>$project_id ?? 0,
            'property'=>$property

        ]);

        return true;


    }
}
<file_sep><?php
namespace App\Actions\Project;

use App\Models\Project;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Actions\Log\ProjectActivityAction;

class UpdateProjectAction
{
    public static function execute($inputs,$id)
    {
        $project=Project::FindOrFail($id);
        $user=User::FindorFail(Auth::id());

        $project->update([
            'title'=>$inputs->title,
            'description'=>$inputs->description,
            'team_id'=>$inputs->teamid
        ]);

        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'project'=>$project])
        ->useLog('Project_Log')
        ->log('Update_Project');

        $project_activity=ProjectActivityAction::execute($user->name,'Update_Project',$project->id,$project);

        if($project_activity)
        {
            return $project;

        }


    }
}
<file_sep><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Actions\Helper\Success;
use App\Actions\Helper\Fail;
use App\Http\Requests\TicketType\StoreTicketTypeRequest;
use App\Http\Requests\TicketType\UpdateTicketTypeRequest;
Use App\Actions\TicketType\DeleteTypeAction;
Use App\Actions\TicketType\GetAllTicketTypeAction;
Use App\Actions\TicketType\GetTypeDetails;
Use App\Actions\TicketType\StoreNewTypeAction;
Use App\Actions\TicketType\UpdateTypeAction;


class TicketTypeController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $response=GetAllTicketTypeAction::execute();
        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(StoreTicketTypeRequest $request)
    {
        $response=StoreNewTypeAction::execute($request);
        if($response)
        {
            return Success::execute('Record Created',$response,2001);

        }
        else
        {
            return Fail::execute('Record can not be created',$response,3001);

        }
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($slug)
    {
        $response=GetTypeDetails::execute($slug);
        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }

    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(UpdateTicketTypeRequest $request, $slug)
    {
        $response=UpdateTypeAction::execute($request,$slug);

        if($response)
        {
            return Success::execute('Record Updated',$response,2002);

        }
        else
        {
            return Fail::execute('Record can not be updated',$response,3002);

        }

    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($slug)
    {
        $response=DeleteTypeAction::execute($slug);

        if($response)
        {
            return Success::execute('Record Deleted',$response,2003);

        }
        else
        {
            return Fail::execute('Record can not be deleted',$response,3003);

        }
    }
}
<file_sep><?php
namespace App\Actions\TicketPriority;

use App\Models\Ticket_priority;

class UpdatePriorityAction
{
    public static function execute($inputs,$slug)
    {
        $priority=Ticket_priority::where('slug',$slug)->FirstOrFail();

        $priority->update([
            'name'=>$inputs->name
        ]);

        return $priority;

    }

}
<file_sep><?php
namespace App\Actions\Project;

use App\Models\Project;

class GetProjectAction
{
    public static function execute($id)
    {
        $project=Project::FindOrFail($id);

        return $project;


    }
}
<file_sep><?php
namespace App\Actions\TicketPriority;

use App\Models\Ticket_priority;

class StoreNewPriorityAction
{
    public static function execute($inputs)
    {
        $priority=Ticket_priority::create([
            'name'=>$inputs->name
        ]);

        return $priority;

    }

}
<file_sep><?php
namespace App\Actions\User;
use App\User;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
class VerificationUserAction
{
    public static function execute($mail)

    {
        $user=User::where('email',$mail)->first();


        if($user!=null)
        {

            $user->email_verified_at=Carbon::now();
            $user->save();

            return $user;

        }




    }




}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Project extends Model
{
    protected $fillable=['title','description','team_id'];


    public  function teams()
    {
        return $this->belongsTo('App\Models\Team');
    }

    public function boards()
    {
        return $this->hasMany('App\Models\Board');
    }

    public function user_permissions()
    {
        return $this->hasMany('App\Models\User_permission');
    }

}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;

class Column extends Model
{
    use HasSlug;

    protected $fillable=['title','board_id'];

    public function getSlugOptions(): SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('title')
            ->saveSlugsTo('slug')
            ->doNotGenerateSlugsOnUpdate();
    }

    public function getRouteKeyName()
    {
        return 'slug';
    }

    //relations
    public  function boards()
    {
        return $this->belongsTo('App\Models\Board');
    }

    public  function tickets()
    {
        return $this->hasMany('App\Models\Ticket');
    }

}
<file_sep><?php
namespace App\Actions\Log;

use App\Models\Activity_log;

class GetAllActivityLogAction
{

    public static function execute()
    {
        $logs=Activity_log::orderBy('id','DESC')->get();

        return $logs;

    }

}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;

class Team extends Model
{
    use HasSlug;

    protected $fillable=['name','description'];

    public function getSlugOptions(): SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('name')
            ->saveSlugsTo('slug')
            ->doNotGenerateSlugsOnUpdate();
    }

    public function getRouteKeyName()
    {
        return 'slug';
    }

//relations

public function users()
{
    return $this->belongsToMany('App\User');

}

public function projects()
{
    return $this->hasMany('App\Models\Project');
}

}
<file_sep><?php
namespace App\Actions\TicketPriority;

use App\Models\Ticket_priority;

class GetPriorityDetailAction
{
    public static function execute($slug)
    {
        $priority=Ticket_priority::where('slug',$slug)->FirstOrFail();

        return $priority;

    }

}
<file_sep><?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Models\User_permission;
use App\Models\Column;
use App\Models\Ticket;
use App\Models\Board;
use Illuminate\Support\Str;
class CheckSystemPermission extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string|null
     */

     public function handle($request, Closure $next, ...$guards)
     {
        if (Auth::check())
        {
            $userid=Auth::id();
            $user=User::FindOrfail($userid);
            $Iflog = Str::contains($request->ActionType, 'logs');
            $Ifteam = Str::contains($request->ActionType, 'teams');
            $Ifuser = Str::contains($request->ActionType, 'users');
            $Ifpermission = Str::contains($request->ActionType, 'permissions');
            $Ifproject = Str::contains($request->ActionType, 'projects');
            $Ifboard = Str::contains($request->ActionType, 'boards');
            $Ifcolumn = Str::contains($request->ActionType, 'columns');
            $Ifticket = Str::contains($request->ActionType, 'tickets');
            $Ifstoreboard=Str::contains($request->ActionType, 'create boards');
            $Ifstorecolumn=Str::contains($request->ActionType, 'create columns');
            $Ifstoreticket=Str::contains($request->ActionType, 'create tickets');

            if($user->role_id==1 || $user->role_id==2 || $user->role_id==3)
            {


                if($Iflog)
                {

                 $permission=User_permission::where('user_name',$user->email)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }



                }

                if($Ifteam)
                {
                    $permission=User_permission::where('user_name',$user->email)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }

                }

                if($Ifuser)
                {
                    $permission=User_permission::where('user_name',$user->email)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }

                }

                if($Ifpermission)
                {
                    $permission=User_permission::where('user_name',$user->email)->
                    where('project_id',$request->project_id)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }

                }

                if($Ifstoreboard)
                {
                    $permission=User_permission::where('user_name',$user->email)->
                    where('project_id',$request->project_id)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }

                }
                elseif($Ifstorecolumn)
                {
                    $board=Board::where('id',$request->board_id)->FirstOrFail();

                    $permission=User_permission::where('user_name',$user->email)->
                    where('project_id',$board->project_id)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }

                }

                elseif($Ifstoreticket)
                {
                    $board=Board::where('id',$request->board_id)->FirstOrFail();
                    $permission=User_permission::where('user_name',$user->email)->
                    where('project_id',$board->project_id)->
                    select('permission_name')->get();

                    foreach($permission as $x)
                    {
                       if($x['permission_name']==$request->ActionType)
                       {
                        return $next($request);

                       }

                    }}



                elseif($Ifboard)
                {
                    if($request->ActionType=='Can fetch columns')
                    {
                    $board=Board::where('id',$request->id)->FirstOrFail();

                    }

                 $board=Board::where('slug',$request->slug)->FirstOrFail();

                $permission=User_permission::where('user_name',$user->email)->
                where('project_id',$board->project_id)->
                select('permission_name')->get();

                foreach($permission as $x)
                {
                   if($x['permission_name']==$request->ActionType)
                   {
                    return $next($request);

                   }

                }

            }

            elseif($Ifcolumn)
            {
                $column=Column::where('slug',$request->slug)->FirstOrFail();
                $board=Board::FindOrFail($column->board_id);

                $permission=User_permission::where('user_name',$user->email)->
                where('project_id',$board->project_id)->
                select('permission_name')->get();

                foreach($permission as $x)
                {
                   if($x['permission_name']==$request->ActionType)
                   {
                    return $next($request);

                   }

                }

            }

            elseif($Ifticket)
            {
                $ticket=Ticket::where('slug',$request->slug)->FirstOrFail();
                $column=Column::FindOrFail($ticket->column_id);
                $board=Board::FindOrFail($column->board_id);

                $permission=User_permission::where('user_name',$user->email)->
                where('project_id',$board->project_id)->
                select('permission_name')->get();

                foreach($permission as $x)
                {
                   if($x['permission_name']==$request->ActionType)
                   {
                    return $next($request);

                   }

                }
            }

            elseif($Ifproject)
            {
                $permission=User_permission::where('user_name',$user->email)->
                where('project_id',$request->id)->
                select('permission_name')->get();

                foreach($permission as $x)
                {
                   if($x['permission_name']==$request->ActionType)
                   {
                    return $next($request);

                   }

                }
            }



           }

        }

       return response()->json(['error' => 'Not have Permissions'], 401);

     }


}
<file_sep><?php
namespace App\Actions\Project;
use App\Models\Board;

class GetProjectBoardAction
{
    public static function execute($id)
    {
        $board=Board::where('project_id',$id)->get();

        return $board;

    }

}
<file_sep><?php
namespace App\Actions\Board;
use App\Models\Board;
use App\User;
use Illuminate\Support\Facades\Auth;
use App\Actions\Log\ProjectActivityAction;

class UpdateBoardsAction
{
    public static function execute($inputs,$slug)
    {
        $board=Board::where('slug',$slug)->FirstOrFail();
        $user=User::FindorFail(Auth::id());

        $board->update([
            'title'=>$inputs->title,
            'description'=>$inputs->description,
            'project_id'=>$inputs->project_id
        ]);

        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'Board'=>$board])
        ->useLog('Board_Log')
        ->log('Update_Board');

        $project_activity=ProjectActivityAction::execute($user->name,'Update_Board',$inputs->project_id,$board);

        if($project_activity)
        {
            return $board;

        }

    }

}
<file_sep><?php
namespace App\Actions\User;
use App\User;
use App\Models\User_permission;

class DeleteUserAction
{
    public static function execute($userid)
    {
        $user=User::FindOrFail($userid);

        $user->teams()->detach();

        $permissions=User_permission::where('user_name',$user->email);

        $permissions->delete();

        $user->delete();


        return true;

    }
}
<file_sep><?php
namespace App\Actions\TeamUser;

use App\Models\Team;
use App\user;
use App\Models\Team_User;

class  GetTeamUsetByid
{
    public static function execute($teamid)
    {
        $team=Team::FindOrFail($teamid);

        $user=User::join('team_user','users.id','=','team_user.user_id')
        ->select('users.id','users.name','users.email')->where('team_user.team_id',$teamid)
        ->get();

        return $user;


    }


}
<file_sep><?php
namespace App\Actions\Team;
use App\Models\Team;

class GetTeamProjectsAction
{
    public static function execute($slug)
    {
       $team=Team::where('slug',$slug)->FirstOrFail();

        return $team->projects;
    }
}
<file_sep><?php
namespace App\Actions\TicketPriority;

use App\Models\Ticket_priority;

class GetAllPriorityAction
{
    public static function execute()
    {
        $priority=Ticket_priority::all();

        return $priority;

    }

}
<file_sep><?php

namespace App\Http\Controllers;

use App\Actions\Helper\Fail;
use App\Actions\Helper\Success;
use Illuminate\Http\Request;
use App\Http\Requests\Project\StoreNewProjectRequest;
use App\Http\Requests\Project\UpdateProjectRequest;
use App\Actions\Project\UpdateProjectAction;
use App\Actions\Project\GetAllProjectAction;
use App\Actions\Project\GetProjectAction;
use App\Actions\Project\DeleteProjectAction;
use App\Actions\Project\StoreNewProjectAction;
use App\Actions\Project\GetProjectBoardAction;

class ProjectController extends Controller
{




    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $response=GetAllProjectAction::execute();

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }

    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(StoreNewProjectRequest $request)
    {
        $response=StoreNewProjectAction::execute($request);

        if($response)
        {
            return Success::execute('Record Created',$response,2001);

        }
        else
        {
            return Fail::execute('Record can not be created',$response,3001);

        }

    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $response=GetProjectAction::execute($id);

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(UpdateProjectRequest $request, $id)
    {
        $response=UpdateProjectAction::execute($request,$id);

        if($response)
        {
            return Success::execute('Record Updated',$response,2002);

        }
        else
        {
            return Fail::execute('Record can not be updated',$response,3002);

        }


    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $response=DeleteProjectAction::execute($id);

        if($response)
        {
            return Success::execute('Record Deleted',$response,2003);

        }
        else
        {
            return Fail::execute('Record can not be deleted',$response,3003);

        }


    }

    public function GetProjectBoards($id)
    {

        $response=GetProjectBoardAction::execute($id);

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }

    }
}
<file_sep><?php
namespace App\Actions\User;
use App\User;
use Illuminate\Support\Facades\Auth;

class GetUserProfile
{
    public static function execute()
    {
        $userid=Auth::id();

        $user_profile=User::findOrFail($userid);

        return $user_profile;

    }

}
<file_sep><?php
namespace App\Actions\User;

use App\User;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Support\Facades\Auth;
use App\Models\User_permission;
use App\Mail\EmailForQueuing;
use Illuminate\Support\Facades\Mail;
use App\Jobs\SendEmail;
class StoreNewUserAction
{
    use HasRoles;

    public static function execute($inputs)
    {
        $loguser=User::FindorFail(auth::id());

        if($inputs->role_id==2)
        {
        User_permission::create(['user_name'=>$inputs->email,'role_name'=>'team_leader','permission_name'=>'Can create teams','project_id '=>'0']);
        User_permission::create(['user_name'=>$inputs->email,'role_name'=>'team_leader','permission_name'=>'Can update teams','project_id '=>'0']);
        User_permission::create(['user_name'=>$inputs->email,'role_name'=>'team_leader','permission_name'=>'Can delete teams','project_id '=>'0']);
        User_permission::create(['user_name'=>$inputs->email,'role_name'=>'owner','permission_name'=>'Can update users','project_id'=>'0']);

        }

            $user= User::create([
                'name' => $inputs['name'],
                'email' => $inputs['email'],
                'password' => <PASSWORD>($inputs['<PASSWORD>']),
                'role_id'=>$inputs['role_id']
            ]);

           $user->generateToken();

           activity()
        ->causedBy($user)
        ->withProperties(['user' =>$loguser->email,'Register'=>$user])
        ->useLog('UserLog')
        ->log('Register');

        /* $email = new EmailForQueuing($user);
      Mail::to($user)->send($email);
        dispatch(new SendEmail($user));*/

            return $user;

        }





}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
class Board extends Model
{
    use HasSlug;

    protected $fillable=['title','description','project_id'];

    public function getSlugOptions(): SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('title')
            ->saveSlugsTo('slug')
            ->doNotGenerateSlugsOnUpdate();
    }

    public function getRouteKeyName()
    {
        return 'slug';
    }

    //relations

    public  function projects()
    {
        return $this->belongsTo('App\Models\Project');
    }

    public  function columns()
    {
        return $this->hasMany('App\Models\Column');
    }

}
<file_sep><?php
namespace App\Actions\TicketType;
use App\Models\Ticket_type;

class DeleteTypeAction

{
    public static function execute($slug)
    {
        $type=Ticket_type::where('slug',$slug)->FiRSTOrFail();

        $type->delete();

        return true;

    }



}
<file_sep><?php

use Illuminate\Database\Seeder;
use App\User;
use Illuminate\Support\Facades\Hash;

class UsersTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Let's clear the users table first
        //User::truncate();

       // DB::tabel('role_users')->truncate();


        $admin=User::create([
            'name'=>'Owner',
            'email'=>'<EMAIL>',
            'password'=>Hash::make("<PASSWORD>"),
            'role_id'=>'1'

        ]);
        $admin->generateToken();

    }
}

<file_sep><?php
namespace App\Actions\TeamUser;

use App\Models\Team;
use App\Models\Team_User;
use Illuminate\Support\Facades\Auth;
use App\User;
class  DeleteTeam
{
    public static function execute($teamid)
    {
        $team=Team::FindOrFail($teamid);
        $user=User::FindorFail(Auth::id());
        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'team'=>$team])
        ->useLog('Team_Log')
        ->log('Delete_Team');
        $team->users()->detach();
        $team->delete();

        return true;





    }


}
<file_sep><?php
namespace App\Actions\TicketType;
use App\Models\Ticket_type;

class GetTypeDetails

{
    public static function execute($slug)
    {
        $type=Ticket_type::where('slug',$slug)->FiRSTOrFail();

        return $type;

    }



}
<file_sep><?php
namespace App\Actions\Column;

use App\Models\Column;

class GetAllColumnBoardAction
{
    public static function execute($boaredid)
    {

        $Column=Column::where('board_id',$boaredid)->get();
        return $Column;

    }
}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Http_log extends Model
{
    use HasFactory;

  protected  $fillable=['uri','method','request_body','response'];

}
<file_sep><?php


use Illuminate\Database\Seeder;
use App\Models\Team;
class TeamTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $team=Team::create([
            'name'=>'No Team',
            'description'=>'Self Project Without Team',
            'slug'=>'no-team',
        ]);

    }
}
<file_sep><?php
namespace App\Actions\TicketType;
use App\Models\Ticket_type;

class StoreNewTypeAction

{
    public static function execute($inputs)
    {
        $type=Ticket_type::create([

            'name'=>$inputs->name
            ]);

        return $type;

    }



}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;
use Illuminate\Support\Facades\Auth;
use App\User;
class ArchiveTicketAction
{

    public static function execute($slug)
    {
        $ticket=Ticket::where('slug',$slug)->FirstOrFail();
        $userid=Auth::id();
        $user=User::FindOrFail($userid);
        if($ticket)
        {
            $ticket->is_archive=1;
            $ticket->save();

        }



            return $ticket;



    }

}
<file_sep><?php
namespace App\Actions\TeamUser;

use App\Models\Team;
use App\Models\Team_User;
use Illuminate\Support\Facades\Auth;
use App\User;
class  AddUserToTeam
{
    public static function execute($input)
    {
        $team=Team::FindOrFail($input->team_id);
        $user=User::FindorFail(Auth::id());
        $team->users()->sync($input->user_id);
        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'team_user'=>$team->users()->get()])
        ->useLog('TeamUser_Log')
        ->log('AddUser_Team');

        return $team->users()->get();


    }


}
<file_sep><?php
namespace App\Actions\Team;
use App\Models\Team;
use Spatie\Activitylog\Models\Activity ;
class GetAllTeamAction
{
    public static function execute()
    {

        $team=Team::all();
        return $team;
    }
}
<file_sep><?php
namespace App\Actions\TicketPriority;

use App\Models\Ticket_priority;

class DeletePriorityAction
{
    public static function execute($slug)
    {
        $priority=Ticket_priority::where('slug',$slug)->FirstOrFail();

        $priority->delete();

        return true;

    }

}
<file_sep><?php
namespace App\Actions\Log;

use App\Models\Http_log;

class GetHttpLogAction
{

    public static function execute()
    {
        $logs=Http_log::orderBy('created_at','DESC')->get();

        return $logs;

    }

}
<file_sep><?php
namespace App\Actions\Log;

use App\Models\Project_activity;
use App\Models\Project;

class  ProjectAllActivityAction
{
    public static function execute($projectid)
    {
        $project=Project::FindOrFail($projectid);

        $activity=Project_activity::where('project_id',$projectid)->get();

        return $activity;


    }
}
<file_sep><?php
namespace App\Actions\Board;
use App\Models\Board;

class GetBoardDetailAction
{
    public static function execute($slug)
    {
        $board=Board::where('slug',$slug)->FirstOrFail();

        return $board;

    }

}
<file_sep><?php
namespace App\Actions\Project;

use App\Models\Project;
use App\Models\User_permission;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Models\Permission;
use App\Actions\Log\ProjectActivityAction;

class StoreNewProjectAction
{
    public static function execute($inputs)
    {
        $userid=auth::id();

        $user=User::FindOrFail($userid);

        $permission=Permission::all();

        if($inputs->team_id==null)
        {
           $project=Project::create([
            'title'=>$inputs->title,
            'description'=>$inputs->description,
            'team_id'=>'1'
        ]);

        }
        else
        {
            $project=Project::create([
                'title'=>$inputs->title,
                'description'=>$inputs->description,
                'team_id'=>$inputs->team_id
            ]);

        }

        //create role permission for this project

        foreach($permission as $p)
        {
            $userpermission=User_permission::create(['user_name'=>$user->email,'role_name'=>'team_leader','permission_name'=>$p->name,'project_id'=>$project->id]);

        }

        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'project'=>$project])
        ->useLog('Project_Log')
        ->log('Store_Project');


        $project_activity=ProjectActivityAction::execute($user->name,'Crete_New_Project',$project->id,$project);

        if($project_activity)
        {
            return $project;

        }


    }
}
<file_sep><?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//Auth::routes(['verify' => true]);

Route::group(['middleware' => ['auth:api','HttpLog','cors']], function() {

    Route::post('userregister', 'UsersController@store')->middleware('check_owner');
    Route::post('StoreProject', 'ProjectController@store')->middleware('check_owner');
    Route::post('StoreType', 'TicketTypeController@store')->middleware('check_owner');
    Route::post('StorePriority', 'TicketPriorityController@store')->middleware('check_owner');
    Route::get('DeleteType/{slug}', 'TicketTypeController@destroy')->middleware('check_owner');
    Route::get('DeletePriority/{slug}', 'TicketPriorityController@destroy')->middleware('check_owner');
    Route::post('UpdateType/{slug}', 'TicketTypeController@update')->middleware('check_owner');
    Route::post('UpdatePriority/{slug}', 'TicketPriorityController@update')->middleware('check_owner');
    //**teams routes */
    Route::get('GetTeams', 'TeamController@index')->middleware('check_owner');
    Route::get('GetTeam/{slug}', 'TeamController@show')->middleware('check_owner');
    Route::get('getusersteam/{teamid}', 'TeamUserController@show')->middleware('check_owner');
    Route::get('GetTeamProject/{slug}', 'TeamController@GetTeamProject')->middleware('check_owner');

});


Route::group(['middleware' => ['auth:api','HttpLog','cors']], function() {
Route::get('deleteBoard/{slug}', 'BoardController@destroy')->middleware('CheckSystemPermission');
Route::get('deleteColumn/{slug}', 'ColumnController@destroy')->middleware('CheckSystemPermission');
Route::get('DeleteProject/{id}', 'ProjectController@destroy')->middleware('CheckSystemPermission');
Route::get('DeleteTicket/{slug}', 'TicketController@destroy')->middleware('CheckSystemPermission');
//********************project*/
Route::get('GetAllProject', 'ProjectController@index');
Route::get('GetProjectBoards/{id}', 'ProjectController@GetProjectBoards')->middleware('CheckSystemPermission');
Route::get('GetProject/{id}', 'ProjectController@show')->middleware('CheckSystemPermission');
Route::post('UpdateProject/{id}', 'ProjectController@update')->middleware('CheckSystemPermission');
//******************board */
Route::post('StoreBoard', 'BoardController@store')->middleware('CheckSystemPermission');
Route::post('UpdateBoard/{slug}', 'BoardController@update')->middleware('CheckSystemPermission');
Route::get('GetBoardDetails/{slug}', 'BoardController@show')->middleware('CheckSystemPermission');
//****************column */
Route::get('GetColumnsBoard/{boaredid}', 'ColumnController@GetColumnsBoard')->middleware('CheckSystemPermission');
Route::post('StoreColumn', 'ColumnController@store')->middleware('CheckSystemPermission');
Route::get('GetColumn/{slug}', 'ColumnController@show')->middleware('CheckSystemPermission');
Route::post('UpdateColumn/{slug}', 'ColumnController@update')->middleware('CheckSystemPermission');
//**********************ticket */
Route::post('StoreTicket', 'TicketController@store')->middleware('CheckSystemPermission');
Route::get('GetTicket/{slug}', 'TicketController@show')->middleware('CheckSystemPermission');
Route::post('UpdateTicket/{slug}', 'TicketController@update')->middleware('CheckSystemPermission');
Route::get('GetAllTicket', 'TicketController@index');
Route::get('GetArchiveTicket', 'TicketController@GetArchiveTicket');
Route::get('ArchiveTicket/{slug}', 'TicketController@ArchiveTicket');

//************************************permissions+user */
Route::post('UpdatePermissions', 'UsersController@AddUserPermissions')->middleware('CheckSystemPermission');
Route::post('UpdateUserRole/{userid}','UsersController@UpdateUserRole')->middleware('CheckSystemPermission');
Route::get('DeleteUser/{userid}','UsersController@destroy')->middleware('CheckSystemPermission');
//************************team */
Route::post('UpdateTeam/{slug}', 'TeamController@update')->middleware('CheckSystemPermission');
Route::get('deleteTeam/{slug}', 'TeamController@destroy')->middleware('CheckSystemPermission');
Route::post('StoreNewTeam', 'TeamController@store')->middleware('CheckSystemPermission');
Route::post('UpdateUserTeam/{teamid}', 'TeamUserController@update')->middleware('CheckSystemPermission');
//*****************************log */

});


Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['middleware' => ['auth:api','cors']], function() {

    Route::get('GetUserProfilr','UsersController@GetUserProfile');
    Route::get('GetHttlog', 'LogController@index')->middleware('CheckSystemPermission');
    Route::get('GetAllActivitylog', 'LogController@GetActivities')->middleware('CheckSystemPermission');
    Route::post('logout', 'Auth\LoginController@logout')->middleware('HttpLog');


});

Auth::routes();
Auth::routes(['verify' => true]);
//**************************users routing

Route::post('login', 'Auth\LoginController@login')->middleware(['HttpLog','cors']);
Route::get('UserVirification/{email}','UsersController@VerificationUser')->middleware(['HttpLog','cors']);;

Route::get('GetAllType', 'TicketTypeController@index')->middleware(['HttpLog','cors']);
Route::get('GetType/{slug}', 'TicketTypeController@show')->middleware(['HttpLog','cors']);
//********************************Ticket Priority */
Route::get('GetAllPriority', 'TicketPriorityController@index')->middleware(['HttpLog','cors']);
Route::get('GetPriority/{slug}', 'TicketPriorityController@show')->middleware(['HttpLog','cors']);
//*****************//*/
Route::get('ProjectActivityLog/{projectid}', 'LogController@GetProjectAllActivity')->middleware(['HttpLog','cors']);
Route::post('ForgetPassword', 'Auth\ForgotPasswordController@sendResetLinkEmail')->middleware(['HttpLog','cors']);
Route::post('ResetPassword', 'Auth\ResetPasswordController@reset')->middleware(['HttpLog','cors']);

<file_sep><?php
namespace App\Actions\Project;

use App\Models\Project;
use Illuminate\Support\Facades\Auth;
use App\Models\User_permission;
use App\User;
class GetAllProjectAction
{
    public static function execute()
    {
        $userid=Auth::id();
        $user=User::FindOrFail($userid);
        $projectid=User_permission::where('user_name',$user->email)->
        select('project_id')->distinct()->get();
        $project=Project::whereIn('id',$projectid)->get();


        return $project;


    }
}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;
use Carbon\Carbon;

class GetTicketDetailsAction
{

    public static function execute($slug)
    {
        $datetimeNow=Carbon::now();

        $ticket=Ticket::selectRaw('tickets.*,TIMESTAMPDIFF(SECOND,tickets.created_at,now()) as duration')
        ->where('slug',$slug)->get();

        return $ticket;

    }

}
<file_sep><?php
namespace App\Actions\Team;
use App\Models\Team;
use Illuminate\Support\Facades\Auth;
use App\User;
class UpdateTeamAction
{
    public static function execute($inputs,$slug)
    {
        $team=Team::where('slug',$slug)->FirstOrFail();
        $user=User::FindorFail(Auth::id());

        $team->update([
            'name'=>$inputs->name,
            'description'=>$inputs->description
        ]);

        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'team'=>$team])
        ->useLog('Team_Log')
        ->log('Update_Team');

        return $team;


    }


}
<file_sep><?php
namespace App\Actions\Board;
use App\Models\Board;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Actions\Log\ProjectActivityAction;

class DeleteProjectBoardAction
{
    public static function execute($slug)
    {
        $user=User::FindorFail(Auth::id());
        $board=Board::where('slug',$slug)->FirstOrFail();
        $column=$board->columns();
        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'Board'=>$board,'Column'=>$column])
        ->useLog('Board_Log')
        ->log('Delete_Board');
        $project_activity=ProjectActivityAction::execute($user->name,'Delete_Board',$board->project_id,$column);

        if($project_activity)
        {
            $column->delete();
            $board->delete();
            return true;
        }


    }

}
<file_sep><?php
namespace App\Actions\User;
use App\User;
use Illuminate\Support\Facades\Auth;
use App\Models\User_permission;
use PhpParser\Node\Stmt\Return_;
use App\Models\Role;
class AdduseerPermission

{
    public static function execute($inputs)
    {
        $userid=Auth::id();
        $user=User::FindorFail($userid);

        $userto=User::where('email',$inputs->user_email)->FirstOrFail();

        $roleto=Role::FindOrFail($userto->role_id);

        if($user->role_id==2 && strtoupper($roleto->name)=='OWNER')
        {
            return false;

        }

        $userpermission=User_permission::where('user_name',$inputs->user_email)->
        where('project_id',$inputs->project_id);



         $userpermission->delete();





        foreach($inputs->permission_name as $p)
        {
            $permissions=User_permission::create([
                'user_name'=>$inputs->user_email,
                'role_name'=>$roleto->name,
                'permission_name'=>$p,
                'project_id'=>$inputs->project_id,
            ]);

        }
        //logout

        if ($userto) {
            $userto->api_token = null;
            $userto->save();
        }

        return $permissions;

    }

}

<file_sep><?php
namespace App\Actions\Column;

use App\Models\Column;

class GetColumnDetails
{
    public static function execute($slug)
    {
        $Column=Column::where('slug',$slug)->FirstOrFail();
        return $Column;

    }
}
<file_sep><?php

namespace App\Http\Controllers;

use App\Actions\User\GetUserProfile;
use App\Actions\Helper\Fail;
use App\Actions\Helper\Success;
use App\Http\Requests\UserRole\UpdateUserRoleRequest;
use App\Actions\User\AddUserRoleAction;
use App\Actions\User\AdduseerPermission;
use App\Actions\User\VerificationUserAction;
use App\Actions\User\StoreNewUserAction;
use App\Actions\User\DeleteUserAction;
use App\Http\Requests\UserRole\StoreUserRequest;
use App\Http\Requests\UserRole\StoreUserPernissionRequest;

class UsersController extends Controller
{



   public function GetUserProfile()
   {
      $response=GetUserProfile::execute();
      if($response)
      {
          return Success::execute('Record(s) fetched successfully',$response,2000);

      }
      else
      {
        return Fail::execute('Record(s) can not be fetched',$response,3000);

      }

   }




   public function UpdateUserRole(UpdateUserRoleRequest $requset,$userid)
   {
       $response=AddUserRoleAction::execute($requset,$userid);

       if ($response)
       {
           return Success::execute('Record Updated',$response,2002);

       }
       else
       {
        return Fail::execute('Record can not be updated',$response,3002);

       }

   }



    public function VerificationUser($mail)
    {
        $response=VerificationUserAction::execute($mail);
        if($response)
        {
            //return Success::execute('User_Verified',$response);

            return redirect('https://testing.testhis.link/');

        }
        else
        {
            return Fail::execute('User_Verified_error',$response);

        }
    }

    public function store(StoreUserRequest $request)
    {

        $response=StoreNewUserAction::execute($request);
        if($response)
        {
            return Success::execute('Record Created',$response,2001);

        }
        else
        {
            return Fail::execute('Record can not be created',$response,3001);

        }
    }

    public function AddUserPermissions(StoreUserPernissionRequest $request)
    {
        $response=AdduseerPermission::execute($request);

       if ($response)
       {
           return Success::execute('Record Updated',$response,2002);

       }
       else
       {
        return Fail::execute('Record can not be updated',$response,3002);

       }

    }

    public function destroy($userid)
    {
        $response=DeleteUserAction::execute($userid);

        if($response)
        {
            return Success::execute('Record Deleted',$response,2003);

        }
        else
        {
            return Fail::execute('Record can not be deleted',$response,3003);

        }
    }



}
<file_sep><?php
namespace App\Actions\TicketType;
use App\Models\Ticket_type;

class GetAllTicketTypeAction

{
    public static function execute()
    {
        $type=Ticket_type::all();

        return $type;

    }



}
<file_sep><?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Support\Facades\Auth;
use App\User;
class CheckUserPermissions extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string|null
     */

     public function handle($request, Closure $next, ...$guards)
     {
        if (Auth::check())
        {
            $userid=Auth::id();
            $user=User::FindOrfail($userid);

            if($user->role_id==1 || $user->role_id==2)
            {
                return $next($request);

           }

        }

       return response()->json(['error' => 'Not have Permissions'], 401);


     }


}
<file_sep><?php
namespace App\Actions\Project;

use App\Models\Project;
use App\Models\Column;
use App\Models\User_permission;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Actions\Log\ProjectActivityAction;

class DeleteProjectAction
{
    public static function execute($id)
    {
        $project=Project::FindOrFail($id);
        $user=User::FindorFail(Auth::id());

        $board=$project->boards();

        $permission=User_permission::where('project_id',$id);
        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'project'=>$project,'board'=>$board])
        ->useLog('Project_Log')
        ->log('Delete_Project');

        $project_activity=ProjectActivityAction::execute($user->name,'Delete_Project',$project->id,$project);

        if($project_activity)
        {
            foreach($board as $b)
            {

           $column=Column::where('board_id',$b->id);

           $column->delete();

            }
            $board->delete();
            $project->delete();
            $permission->delete();

            return true;
        }



    }
}
<file_sep><?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Project_activity extends Model
{
    use HasFactory;

    protected $table='project_activity';


    protected $fillable=['user_name','action_type','project_id','property'];

    protected $casts = [
        'property' => 'array'
    ];

}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;
use Illuminate\Support\Facades\Auth;

class GetArchiveTicketAction
{

    public static function execute()
    {
        $userid=Auth::id();

        $ticket=Ticket::where('assign_id',$userid)->
        where('is_archive','1')->get();
        return $ticket;

    }

}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;

class DeleteTicketAction
{

    public static function execute($id)
    {
        $ticket=Ticket::where('slug',$id)->FirstOrFail();

        $ticket->delete();

        return true;

    }

}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Actions\Log\ProjectActivityAction;
use App\Models\Board;

class StoreNewTicketAction
{


    public static function execute($inputs)
    {
        $userid=Auth::id();
        $user=User::FindOrFail($userid);
        $board=Board::FindOrFail($inputs->board_id);
        $ticket=Ticket::create([
            'title'=>$inputs->title,
            'content'=>$inputs->content,
            'reporter_id'=>$userid,
            'assign_id'=>$inputs->assign_id,
            'board_id'=>$inputs->board_id,
            'type_id'=>$inputs->type_id,
            'priority_id'=>$inputs->priority_id,
            'column_id'=>$inputs->column_id,
            'parent_id'=>$inputs->parent_id

        ]);

        activity()
        ->causedBy($user)
        ->withProperties(['user'=>$user->email,'ticket'=>$ticket])
        ->useLog('Ticket_Log')
        ->log('Store_Ticket');

        $project_activity=ProjectActivityAction::execute($user->name,'Create_Ticket',$board->project_id,$ticket);

        if($project_activity)
        {
            return $ticket;
        }

    }

}
<file_sep><?php
namespace App\Actions\Ticket;

use App\Models\Ticket;
use Illuminate\Support\Facades\Auth;

class GetAllTicketsAction
{

    public static function execute()
    {
        $userid=Auth::id();

        $ticket=Ticket::selectRaw('tickets.*,TIMESTAMPDIFF(SECOND,tickets.created_at,now()) as duration')
        ->where('assign_id',$userid)->
        where('is_archive','0')->get();
        return $ticket;

    }

}
<file_sep><?php
namespace App\Actions\Column;

use App\Models\Column;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Actions\Log\ProjectActivityAction;
use App\Models\Board;
class DeleteColumnAction
{
    public static function execute($slug)
    {
        $Column=Column::where('slug',$slug)->FirstOrFail();
        $user=User::FindorFail(Auth::id());
        $board=Board::FindorFail($Column->board_id);
        activity()
        ->causedBy($user)
        ->withProperties(['name' => $user->name,'email'=>$user->email,'role_id'=>$user->role_id,'Column'=>$Column])
        ->useLog('Column_Log')
        ->log('Delete_Column');
        $project_activity=ProjectActivityAction::execute($user->name,'Delete_Column',$board->project_id,$Column);
        if($project_activity)
        {
            $Column->delete();
            return true;
        }


    }
}
<file_sep><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Actions\Helper\Fail;
use App\Actions\Helper\Success;
use App\Actions\Log\GetHttpLogAction;
use App\Actions\Log\GetAllActivityLogAction;
use App\Actions\Log\GetActivityUserLogAction;
use App\Actions\Log\ProjectAllActivityAction;

class LogController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $response=GetHttpLogAction::execute();

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }

    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function GetActivities()
    {
        $response=GetAllActivityLogAction::execute();

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }
    }



    public function GetProjectAllActivity($projectid)
    {
        $response=ProjectAllActivityAction::execute($projectid);

        if($response)
        {
            return Success::execute('Record(s) fetched successfully',$response,2000);

        }
        else
        {
            return Fail::execute('Record(s) can not be fetched',$response,3000);

        }
    }




    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
<file_sep><?php

use Illuminate\Database\Seeder;
use App\Models\Permission;
use App\Models\User_permission;

class PermissionTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Permission::create(['name'=>'Can create teams','guard_name'=>'web']);
        Permission::create(['name'=>'Can update teams','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete teams','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch teams','guard_name'=>'web']);
        Permission::create(['name'=>'Can create boards','guard_name'=>'web']);
        Permission::create(['name'=>'Can update boards','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete boards','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch boards','guard_name'=>'web']);
        Permission::create(['name'=>'Can create columns','guard_name'=>'web']);
        Permission::create(['name'=>'Can update columns','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete columns','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch columns','guard_name'=>'web']);
        Permission::create(['name'=>'Can create tickets','guard_name'=>'web']);
        Permission::create(['name'=>'Can update tickets','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete tickets','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch tickets','guard_name'=>'web']);
        Permission::create(['name'=>'Can create users','guard_name'=>'web']);
        Permission::create(['name'=>'Can update users','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete users','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch users','guard_name'=>'web']);
        Permission::create(['name'=>'Can create roles','guard_name'=>'web']);
        Permission::create(['name'=>'Can update roles','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete roles','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch roles','guard_name'=>'web']);
        Permission::create(['name'=>'Can create permissions','guard_name'=>'web']);
        Permission::create(['name'=>'Can update permissions','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete permissions','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch system logs','guard_name'=>'web']);
        Permission::create(['name'=>'Can create projects','guard_name'=>'web']);
        Permission::create(['name'=>'Can update projects','guard_name'=>'web']);
        Permission::create(['name'=>'Can delete projects','guard_name'=>'web']);
        Permission::create(['name'=>'Can fetch projects','guard_name'=>'web']);

        //-***************************************************Owner permissions
        User_permission::create(['user_name'=>'<EMAIL>','role_name'=>'owner','permission_name'=>'Can create teams','project_id'=>'0']);
        User_permission::create(['user_name'=>'<EMAIL>','role_name'=>'owner','permission_name'=>'Can update teams','project_id'=>'0']);
        User_permission::create(['user_name'=>'<EMAIL>','role_name'=>'owner','permission_name'=>'Can delete teams','project_id'=>'0']);
        User_permission::create(['user_name'=>'<EMAIL>','role_name'=>'owner','permission_name'=>'Can update users','project_id'=>'0']);
        User_permission::create(['user_name'=>'<EMAIL>','role_name'=>'owner','permission_name'=>'Can fetch system logs','project_id'=>'0']);

    }
}
<file_sep><?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Auth\Notifications\VerifyEmail;

class CustomVerifyEmailQueued extends VerifyEmail implements ShouldQueue
{
    use Queueable;

}
<file_sep><?php
namespace App\Actions\User;
use App\Models\Role;
use App\User;
use App\Http\Requests\UserRole\UpdateUserRoleRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Hash;
use App\Models\User_permission;
use Illuminate\Support\Facades\Auth;

class AddUserRoleAction
{
    public static function execute($inputs,$userid)
    {
        $user=User::FindOrFail($userid);
        $loguser=User::FindorFail(auth::id());

        $user->update([
            'name'=>$inputs->name,
            'email'=>$inputs->email,
            'role_id'=>$inputs->role_id,
            'password' => <PASSWORD>($inputs->password),
        ]
        );

        activity()
        ->causedBy($user)
        ->withProperties(['user' =>$loguser->email,'Register'=>$user])
        ->useLog('UserLog')
        ->log('UpdateUser');

    $permissions=User_permission::where('user_name',$inputs->email);

    $permissions->delete();

        return $user;

    }

    }

