Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbabul committed Nov 1, 2021
1 parent 94d087d commit 550d0d0
Show file tree
Hide file tree
Showing 26 changed files with 968 additions and 252 deletions.
17 changes: 16 additions & 1 deletion app/Http/Controllers/CustomerApprovalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\customer_request;
use Illuminate\Http\Request;
use App\Models\admin;
use App\Models\map;
use Illuminate\Support\Facades\Hash;


Expand Down Expand Up @@ -81,6 +82,7 @@ function customer_request_process(Request $request){
$data= customer_request::where('email', '=',$request->email)->first();

$customer = new customer;
$marker = new map;

$customer->name= $data->name;
$customer->email= $data->email;
Expand All @@ -93,7 +95,20 @@ function customer_request_process(Request $request){

$customer->lat = $data->lat;
$customer->long= $data->long;



$marker->name= $data->name;
$marker->username= $data->email;

$marker->description= "red";
$marker->thana = $data->Thana;
$marker->cont_no = $data->cont_no;
$marker->dist = $data->post;


$marker->latitude = $data->lat;
$marker->longitude= $data->long;
$marker->save();

$save=$customer->save();
$data->delete();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function location(){

// return view('category.index', compact(['categories', 'products']));
return view('customer.buslocation', $data)->with(compact(['data','location','marker']));
//return view('customer.buslocation',$data)->with('location', $datamap);;
}


Expand Down
126 changes: 126 additions & 0 deletions app/Http/Controllers/DriverController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;
use App\Models\driver;
use App\Models\map;
use Illuminate\Support\Facades\Hash;
class DriverController extends Controller
{
Expand Down Expand Up @@ -75,4 +76,129 @@ public function added_driver(Request $request){
}

}

public function driver_update_profile(){
$data= ['loggedUser' =>driver::where('id', '=',session('loggedUser'))->first()];

return view('driver.driver_update_profile',$data);
}

public function deriver_update_image(Request $request){

$data= driver::where('id', '=', session('loggedUser'))->first();
$path= "image/customer_profile/";
$data->image= $path.$request->img;

$save = $data->save();
if($save){
return back()->with('success','successfully Added Image');
}
else{
return back()->with('fail','somthing is wrong');
}


}

public function driverUpdateProfile(Request $request){

//return $request->all();
$data = driver::where('id','=',session('loggedUser'))->first();

$data->cont_no= $request->cont;
$data->post = $request->post;
$data->thana= $request->thana;
$data->zila= $request->district;
$save = $data->save();
if($save){
return back()->with('success','successfully Profile Updated');
}
else{
return back()->with('fail','somthing is wrong');
}


}

public function driver_password_change(){

$data= ['loggedUser' =>driver::where('id', '=',session('loggedUser'))->first()];
return view('driver.password_change', $data);
}


public function driver_update_password(Request $request){

$data= driver::where('id', '=',session('loggedUser'))->first();

$request->validate([

'old' =>'required |min:5|max:12 ',
'new' =>'required |min:5|max:12 ',
'confirm' =>'required |min:5|max:12 '
]);

if(Hash::check($request->old, $data->password)){
if($request->new != $request->confirm){
return back()->with('fail','password not mathcing');
}




else {
$data->password= \Hash::make($request->new);



$save= $data->save();
if($save) return back()->with('success','Password Changed');
else return back()->with('fail','Something is wrong');
}

}
else {
return back()->with('fail','incorrect password');
}

}


public function updateDriverProfile( Request $request){

$data = driver::where('email','=', $request->email)->first();
$data->bus_no =$request->busno;
$data->area=$request->area;
$data->rank= $request->rank;

$save=$data->save();
if($save) return back()->with('success','Information Changed');
else return back()->with('fail','Something is wrong');


}

public function viewroute(){

$data= ['loggedUser' =>driver::where('id', '=',session('loggedUser'))->first()];

return view('driver.viewroute',$data);
}

public function drivercollect_waste(){
$data= ['loggedUser' =>driver::where('id', '=',session('loggedUser'))->first()];

$d = driver::where ('id', '=', session('loggedUser'))->first();




$location= map::where('username', '=' , $d->email)->first();

$marker = map::orderBy('id')->get();



return view('driver.collect_waste',$data)->with(compact(['data','location','marker']));
}
}
45 changes: 45 additions & 0 deletions app/Http/Controllers/admincontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\customer;
use App\Models\customer_request;
use App\Models\driver;
use App\Models\map;
use Illuminate\Support\Facades\Hash;

class admincontroller extends Controller
Expand Down Expand Up @@ -261,4 +262,48 @@ public function logout(){
return redirect('LoginAdmin');
}
}

public function update_driver_info( Request $email){


$data= ['loggedUser'=> admin::where('id', '=', session('loggedUser'))->first()];

$count=0;
for ($x = 24; $x < strlen($email); $x++) {
if( substr($email, $x, 4)==".com"){
$count= $count+4;
break;
}
$count++;
}


$ds= substr($email,24,$count);

$dt =driver::where('email' , '=', $ds)->first();

return view('admin.update_driver_info',$data)->with('user', $dt);
}

public function reset_collection(){
$data= ['loggedUser'=> admin::where('id', '=', session('loggedUser'))->first()];
return view('admin.reset_collection',$data);
}

public function garbage_status(){
$data= ['loggedUser' =>admin::where('id', '=',session('loggedUser'))->first()];

$d = admin::where ('id', '=', session('loggedUser'))->first();




$location= map::where('username', '=' , $d->email)->first();

$marker = map::orderBy('id')->get();

// return view('category.index', compact(['categories', 'products']));
return view('admin.garbage_status', $data)->with(compact(['data','location','marker']));

}
}
32 changes: 24 additions & 8 deletions app/Http/Controllers/mapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ public function update_customer_location(Request $request){

$data->lat= $request->let;
$data->long= $request->long;


$marker->username= $data->email;
$marker->latitude= $request->let;
$marker->longitude=$request->long;


$save = $marker->save();

$save = $data->save();

if($save){
Expand All @@ -43,5 +36,28 @@ public function update_customer_location(Request $request){

}

public function reset(){

$marker = map::orderBy('id')->get();

foreach($marker as $mar) {
$mar->description = 'red';
$mar->save();
}

return back()->with('success','successfully reset');
}

public function collect(Request $request){

$data= map::where('username','=', $request->email)->first();

$data->description="green";
$data->save();

return back();
}



}
4 changes: 2 additions & 2 deletions app/Http/Middleware/authAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class authAdmin
*/
public function handle(Request $request, Closure $next)
{
if(!session()->has('loggedUser') && ($request->path()=='admin_profile' || $request->path()=='desboard' || $request->path()=='customer_complain' || $request->path()=='admin_feedback' || $request->path()=='admin_notification' || $request->path()=='admin_massage' || $request->path()=='request_pendin' || $request->path()=='card_rechage' || $request->path()=='customers_list' || $request->path()=='driver_list' || $request->path()=='user_profile' || $request->path()=='admin_logout' || $request->path()=='add_customer'|| $request->path()=='remove_customer' || $request->path()=='add_driver'|| $request->path()=='remove_driver' || $request->path()=='card_request' || $request->path()=='update_profile' || $request->path()=='password_reset' || $request->path()=='user_profile_driver' || $request->path()=='customer_select')){
if(!session()->has('loggedUser') && ($request->path()=='admin_profile' || $request->path()=='desboard' || $request->path()=='customer_complain' || $request->path()=='admin_feedback' || $request->path()=='admin_notification' || $request->path()=='admin_massage' || $request->path()=='request_pendin' || $request->path()=='card_rechage' || $request->path()=='customers_list' || $request->path()=='driver_list' || $request->path()=='user_profile' || $request->path()=='admin_logout' || $request->path()=='add_customer'|| $request->path()=='remove_customer' || $request->path()=='add_driver'|| $request->path()=='remove_driver' || $request->path()=='card_request' || $request->path()=='update_profile' || $request->path()=='password_reset' || $request->path()=='user_profile_driver' || $request->path()=='customer_select' || $request->path()=='update_driver_info' || $request->path()=='reset_collection' || $request->path()=='garbage_status')){

return redirect('LoginAdmin')->with('fail','You must log in');
}
if(session()->has('loggedUser') && ($request->path()!='admin_profile' && $request->path()!='desboard' && $request->path()!='customer_complain' && $request->path()!='admin_feedback' && $request->path()!='admin_notification' && $request->path()!='admin_massage' && $request->path()!='request_pendin' && $request->path()!='card_rechage' && $request->path()!='customers_list' && $request->path()!='driver_list' && $request->path()!='user_profile' && $request->path()!='admin_logout' && $request->path()!='add_customer'&& $request->path()!='remove_customer' && $request->path()!='add_driver'&& $request->path()!='remove_driver' && $request->path()!='card_request' && $request->path()!='update_profile' && $request->path()!='password_reset' && $request->path()!='user_profile_driver' && $request->path()!='customer_select')){
if(session()->has('loggedUser') && ($request->path()!='admin_profile' && $request->path()!='desboard' && $request->path()!='customer_complain' && $request->path()!='admin_feedback' && $request->path()!='admin_notification' && $request->path()!='admin_massage' && $request->path()!='request_pendin' && $request->path()!='card_rechage' && $request->path()!='customers_list' && $request->path()!='driver_list' && $request->path()!='user_profile' && $request->path()!='admin_logout' && $request->path()!='add_customer'&& $request->path()!='remove_customer' && $request->path()!='add_driver'&& $request->path()!='remove_driver' && $request->path()!='card_request' && $request->path()!='update_profile' && $request->path()!='password_reset' && $request->path()!='user_profile_driver' && $request->path()!='customer_select' && $request->path()!='update_driver_info' && $request->path()!='reset_collection' && $request->path()!='garbage_status')){
return back();
}
return $next($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ public function up()
$table->text('cont_no')->nullable();
$table->text('driverRegiNo')->nullable();
$table->text('password')->nullable();
$table->text('post')->nullable();
$table->text('thana')->nullable();
$table->text('zila')->nullable();
$table->integer('bus_no')->nullable();
$table->text('area')->nullable();
$table->integer('rank')->nullable();
$table->text('image')->nullable();
$table->timestamps();

});
}

Expand Down
4 changes: 4 additions & 0 deletions database/migrations/2021_10_07_090345_create_maps_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public function up()
Schema::create('maps', function (Blueprint $table) {
$table->id();
$table->text('username')->nullable();
$table->text('name')->nullable();
$table->text('cont_no')->nullable();
$table->text('thana')->nullable();
$table->text('dist')->nullable();
$table->text('latitude')->nullable();
$table->text('longitude')->nullable();
$table->text('description')->nullable();
Expand Down
Binary file added public/image/user/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions resources/views/admin/add_driver.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@
<h6 class="text-muted f-w-400"><input type="number" name="rank"> </h6>
</div>
</div>
<ul class="social-link list-unstyled m-t-40 m-b-10">
<li><a href="#!" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="facebook" data-abc="true"><i class="mdi mdi-facebook feather icon-facebook facebook" aria-hidden="true"></i></a></li>
<li><a href="#!" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="twitter" data-abc="true"><i class="mdi mdi-twitter feather icon-twitter twitter" aria-hidden="true"></i></a></li>
<li><a href="#!" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="instagram" data-abc="true"><i class="mdi mdi-instagram feather icon-instagram instagram" aria-hidden="true"></i></a></li>
</ul>
<input type="submit" name = "Add Customer" value="Add Customer" class="btn btn-success" style="margin-left:320px; margin-bottom: 30px; ">

<input type="submit" name = "Add Driver" value="Add Driver" class="btn btn-success" style="margin-left:320px; margin-bottom: 30px; ">
</div>
</form>
</div>
Expand Down
Loading

0 comments on commit 550d0d0

Please sign in to comment.