<repo_name>saiyedulbas/bashar-cms<file_sep>/app/Http/Controllers/bashar.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\againmessage;
use carbon\carbon;
use App\about;
use App\about_point;
use App\service;
class bashar extends Controller
{
    function ami(){
		return view('index');
	}
	function tumi(){
		return view('front/team');
	}
	function amra(){
		$first = $_POST['sender_name'];
		$second = $_POST['sender_email'];
		$third = $_POST['sender_message'];
		againmessage::insert([
		   'sender_name' => $first,
		   'sender_email' => $second,
		   'sender_message' => $third,
		   'created_at' => now('Asia/Dhaka'),
		]);
		return back()->with('status','Your message successfully sent');
	}
	public function aboutsection(){
		$din = about::where('about_status','=',2)->firstOrFail();
		$jhula = service::where('service_status','=',1)->orderBy('id','desc')->paginate(3);
		$jhima = about_point::where('about_id','=',$din->id)->get();
		return view('index',compact('din','jhima','jhula'));
	}
	
	
	
	
}
<file_sep>/app/Http/Controllers/HomeController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\againmessage;
use App\about;
use carbon\carbon;
use App\about_point;
use App\service;
use Auth;
use Hash;
use App\User;
class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        return view('home');
    }
	public function aboutsectionultra(){
		$pagol = about::all();
		return view('admin/about',compact('pagol'));
	}
	public function contactmessageview(){
		$dis = againmessage::paginate(2);
		$bagi = againmessage::onlyTrashed()->get();
		return view('admin/message/message',compact('dis','bagi'));
	}
	public function contactdelete($zind){
		againmessage::where('id','=',$zind)->delete();
		return back();
	}
	public function contactmark($zind){
		againmessage::where('id','=',$zind)->update([
			'message_status' => 2
		]);
		return back();
	}
	public function contactedit($zind){
		$lathi = againmessage::findOrFail($zind);
		
		return view('admin/message/edit',compact('lathi'));
		
	}
	public function contactupdate(Request $request){
		$request->validate([
		 'sender_name' => 'required',
		 'sender_email' => 'required|email',
		]);
		$first = $request->sender_name;
		$second = $request->sender_email;
		$third = $request->hiddenin;
		againmessage::where('id','=',$third)->update([
			'sender_name' => $first,
			'sender_email' => $second,
			
		]);
		return back();
		
	}
	public function abouteditinfo(Request $request){
		$first = $request->abouttitle;
		$second = $request->aboutcontent;
		$third = $request->aboutpoint;
		$tuna = about::insertGetId([
		    'about_title' => $first,
			'about_content' => $second,
			'about_point' => $third,
			'created_at' => carbon::now(),
		]);
		if($request->hasFile('againfile')){
			   $path = $request->file('againfile')->store('about_images');
			   about::where('id','=',$tuna)->update([
			          'about_image' => $path
			   ]);
			return back();
		}
		return back();
	}
	public function aboutidtake($mina){
		about::where('about_status','=',2)->update([
		      'about_status' => 1
		]);
		about::where('id','=',$mina)->update([
		      'about_status' => 2
		]);
		return back();
	}
	public function pointinput(){
		$first = $_POST['selectin'];
		$second = $_POST['enterpoint'];
		about_point::insert([
		     'about_id' => $first,
			 'point' => $second,
			 'created_at' => carbon::now(),
		]);
		return back();
	}
	public function mesagerestore($restoreid){
		againmessage::where('id','=',$restoreid)->restore();
		return back();
	}
	public function aboutagainedit($zinda){
		$lathi = about::where('id','=',$zinda)->firstOrFail();
		
		return view('admin/again',compact('lathi'));
	}
	public function editupdateagain(Request $request){
		$first = $request->about_title;
		$second = $request->about_content;
		$third = $request->about_point;
		$fourth = $request->hiddenin;
		about::where('id','=',$fourth)->update([
		     'about_title' => $first,
             'about_content' => $second,
			 'about_point' => $third,
			 ]);
			 return back();
	}
	public function servicesection(){
		$pagol = service::all();
		return view('admin/service',compact('pagol'));
		
	}
	public function serviceactive(Request $request){
		$first = $request->servicetitle;
		$second = $request->servicecontent;
		$sixth = service::insertGetId([
		     'service_title' => $first,
			 'service_details' => $second,
			 'created_at' => carbon::now(),
		]);
		if($request->hasFile('fileinput')){
		$path = $request->file('fileinput')->store('service_images');
		service::where('id','=',$sixth)->update([
		     'service_image' => $path 
		]);

        return back();
		}
		
		return back();
	}
	public function serviceactiveon($jibon){
		service::where('id','=',$jibon)->update([
		       'service_status' => 1
		]);
		return back();
	}
	public function servicedeactive($jibona){
		service::where('id','=',$jibona)->update([
		       'service_status' => 2
		]);
		return back();
	}
	public function passwordchange(){
		return view('admin/change');
	}
	public function changepasswordagain(Request $request){
		     
			  $request->validate([
			     'oldpassword' => '<PASSWORD>',
			     'newpassword' => '<PASSWORD>',
			     'confirmpassword' => 'required|same:newpassword',
				 
			  ]);
			 if(Hash::check($request->oldpassword,Auth::user()->password)){
				 User::where('id','=',Auth::user()->id)->update([
				       'password' => <PASSWORD>($request->newpassword),
				 ]);
				 return back()->with('smoke','your password has been changed successfully');
			 }
		else{
			return back()->withErrors('old password does not match');
		}
	}
	function uploadphoto(){
		return view('admin/upload');
	}
	public function profileupdate(Request $request){
		$first = $request->user_name;
		
		$third = $request->birla;
		User::where('id','=',$third)->update([
		    'name' => $first,
		]);
		if($request->hasFile('subjective')){
			$path = $request->file('subjective')->store('user_images');
			User::where('id','=',$third)->update([
			    'photo' => $path,
			]);
			return back();
			
		}
		return back();
		
	}
	
	
	
}
<file_sep>/routes/web.php
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/bashar',function(){
	echo 'saiyedul bashar is flying';
});

Route::get('/tumi','bashar@tumi');
Route::post('/contact/submit','bashar@amra');
Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('/changepassword', 'HomeController@passwordchange')->name('passwordchange');
Route::get('/contact/message/view', 'HomeController@contactmessageview');
Route::get('/contact/delete/{message_id}', 'HomeController@contactdelete');
Route::get('/contact/mark/{message_id}', 'HomeController@contactmark');
Route::get('/contact/edit/{message_id}', 'HomeController@contactedit');
Route::post('/contact/update', 'HomeController@contactupdate');
Route::post('/abouteditinfo', 'HomeController@abouteditinfo');
Route::post('/pointinput', 'HomeController@pointinput');
Route::post('/change/password/again', 'HomeController@changepasswordagain');
Route::post('/edit/update/again', 'HomeController@editupdateagain');
Route::post('/serviceactive', 'HomeController@serviceactive');
Route::post('/profile/update', 'HomeController@profileupdate');
Route::get('/mesage/restore/{restoreid}', 'HomeController@mesagerestore');
Route::get('/about/again/edit/{againid}', 'HomeController@aboutagainedit');

Route::get('/servicesection', 'HomeController@servicesection');
Route::get('/upload/photo', 'HomeController@uploadphoto');

Route::get('/aboutsection', 'HomeController@aboutsectionultra');
Route::get('/about/idtake/{take}', 'HomeController@aboutidtake');
Route::get('/serviceactiveon/{chara}', 'HomeController@serviceactiveon');
Route::get('/servicedeactive/{ghara}', 'HomeController@servicedeactive');
Route::get('/', 'bashar@aboutsection');







