diff --git a/.env.example b/.env.example deleted file mode 100644 index bd67861..0000000 --- a/.env.example +++ /dev/null @@ -1,49 +0,0 @@ -APP_NAME=Laravel -APP_ENV=local -APP_KEY= -APP_DEBUG=true -APP_URL=http://localhost - -LOG_CHANNEL=stack -LOG_LEVEL=debug - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=laravel -DB_USERNAME=root -DB_PASSWORD= - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -QUEUE_CONNECTION=sync -SESSION_DRIVER=database -SESSION_LIFETIME=120 - -MEMCACHED_HOST=127.0.0.1 - -REDIS_HOST=127.0.0.1 -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_MAILER=smtp -MAIL_HOST=mailhog -MAIL_PORT=1025 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null -MAIL_FROM_ADDRESS=null -MAIL_FROM_NAME="${APP_NAME}" - -AWS_ACCESS_KEY_ID= -AWS_SECRET_ACCESS_KEY= -AWS_DEFAULT_REGION=us-east-1 -AWS_BUCKET= - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= -PUSHER_APP_CLUSTER=mt1 - -MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" -MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php new file mode 100644 index 0000000..6a90a7c --- /dev/null +++ b/app/Http/Controllers/ProjectController.php @@ -0,0 +1,107 @@ +paginate(5); + + return view('projects.index',compact('projects')) + ->with(request()->input('page')); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('projects.create'); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + $request->validate([ + 'name' => 'required', + 'detail' => 'required', + ]); + + project::create($request->all()); + + return redirect()->route('projects.index') + ->with('success','Project created successfully.'); + } + + /** + * Display the specified resource. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function show(project $project) + { + return view('projects.show',compact('project')); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function edit(project $project) + { + return view('projects.edit',compact('project')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function update(Request $request, project $project) + { + $request->validate([ + 'name' => 'required', + 'detail' => 'required', + ]); + + $project->update($request->all()); + + return redirect()->route('projects.index') + ->with('success','Project updated successfully'); + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function destroy(project $project) + { + $project->delete(); + + return redirect()->route('projects.index') + ->with('success','Project deleted successfully'); + } +} diff --git a/app/Models/Project.php b/app/Models/Project.php new file mode 100644 index 0000000..2d6f8ea --- /dev/null +++ b/app/Models/Project.php @@ -0,0 +1,17 @@ +paginate(5); + + return view('projects.index',compact('projects')) + ->with(request()->input('page')); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('projects.create'); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + $request->validate([ + 'name' => 'required', + 'detail' => 'required', + ]); + + project::create($request->all()); + + return redirect()->route('projects.index') + ->with('success','project created successfully.'); + } + + /** + * Display the specified resource. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function show(project $project) + { + return view('projects.show',compact('project')); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function edit(project $project) + { + return view('projects.edit',compact('project')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function update(Request $request, project $project) + { + $request->validate([ + 'name' => 'required', + 'detail' => 'required', + ]); + + $project->update($request->all()); + + return redirect()->route('projects.index') + ->with('success','project updated successfully'); + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Models\project $project + * @return \Illuminate\Http\Response + */ + public function destroy(project $project) + { + $project->delete(); + + return redirect()->route('projects.index') + ->with('success','project deleted successfully'); + } +} diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php new file mode 100644 index 0000000..12b186a --- /dev/null +++ b/database/factories/ProductFactory.php @@ -0,0 +1,29 @@ + $this->faker->name, + 'detail' => $this->faker->text(200) + ]; + } +} diff --git a/database/migrations/2020_12_31_080627_create_projects_table.php b/database/migrations/2020_12_31_080627_create_projects_table.php new file mode 100644 index 0000000..e54d4a8 --- /dev/null +++ b/database/migrations/2020_12_31_080627_create_projects_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('name'); + $table->string('detail'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('projects'); + } +} diff --git a/database/migrations/2021_05_11_084959_associate_companies_individuals.php b/database/migrations/2021_05_11_084959_associate_companies_individuals.php index 606f2b1..040b971 100644 --- a/database/migrations/2021_05_11_084959_associate_companies_individuals.php +++ b/database/migrations/2021_05_11_084959_associate_companies_individuals.php @@ -14,18 +14,20 @@ class AssociateCompaniesIndividuals extends Migration public function up() { Schema::create('associate_companies_individuals', function (Blueprint $table) { - //$table->id(); $table->bigIncrements('id'); $table->unsignedBigInteger('user_id'); $table->foreign('user_id')->references('id')->on('users'); $table->string('name', 100); $table->enum('type', ['company', 'individual']); $table->string('phone'); - //$table->binary('logo'); $table->text('description'); $table->timestamps(); }); - DB::statement("ALTER TABLE associate_companies_individuals ADD logo MEDIUMBLOB"); + + // Adding the logo column as BLOB after table creation + Schema::table('associate_companies_individuals', function (Blueprint $table) { + $table->binary('logo')->after('description')->nullable(); + }); } /** @@ -35,6 +37,7 @@ public function up() */ public function down() { + // Dropping the table if it exists Schema::dropIfExists('associate_companies_individuals'); } } diff --git a/database/migrations/2021_05_26_124648_create_associates_table.php b/database/migrations/2021_05_26_124648_create_associates_table.php index a4df820..670910b 100644 --- a/database/migrations/2021_05_26_124648_create_associates_table.php +++ b/database/migrations/2021_05_26_124648_create_associates_table.php @@ -15,12 +15,12 @@ public function up() { Schema::create('associates', function (Blueprint $table) { $table->id(); - $table->string('name'); - $table->string('type'); - $table->string('address'); - $table->string('email'); - $table->('phone1'); - $table->('phone2'); + $table->string('name'); + $table->string('type'); + $table->string('address'); + $table->string('email'); + $table->string('phone1'); // Added 'string' to specify data type + $table->string('phone2'); // Added 'string' to specify data type $table->timestamps(); }); } diff --git a/database/seeders/ProjectTableSeeder.php b/database/seeders/ProjectTableSeeder.php new file mode 100644 index 0000000..037efc0 --- /dev/null +++ b/database/seeders/ProjectTableSeeder.php @@ -0,0 +1,76 @@ + 'Product #1', + 'detail' => 'Product #1 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #2', + 'detail' => 'Product #2 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #3', + 'detail' => 'Product #3 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #4', + 'detail' => 'Product #4 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #5', + 'detail' => 'Product #5 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #6', + 'detail' => 'Product #6 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #7', + 'detail' => 'Product #7 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #8', + 'detail' => 'Product #8 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #9', + 'detail' => 'Product #9 details' + ]); + $product->save(); + + $product = new \App\Models\Product([ + 'name' => 'Product #10', + 'detail' => 'Product #10 details' + ]); + $product->save(); + } +} diff --git a/resources/views/profile/update-profile-information-form.blade.php b/resources/views/profile/update-profile-information-form.blade.php index d01f102..d7f8cf0 100644 --- a/resources/views/profile/update-profile-information-form.blade.php +++ b/resources/views/profile/update-profile-information-form.blade.php @@ -8,49 +8,7 @@ - - @if (Laravel\Jetstream\Jetstream::managesProfilePhotos()) -
- - - - - - -
- {{ $this->user->name }} -
- - -
- - -
- - - {{ __('Select A New Photo') }} - - - @if ($this->user->profile_photo_path) - - {{ __('Remove Photo') }} - - @endif - - -
- @endif +
diff --git a/resources/views/projects/create.blade.php b/resources/views/projects/create.blade.php new file mode 100644 index 0000000..b91f524 --- /dev/null +++ b/resources/views/projects/create.blade.php @@ -0,0 +1,70 @@ + + +
+ + Back + +

Project Management

+
+
+ +
+
+
+
+ +
+
+

Add New Project

+
+
+ + +
+
+ @if ($errors->any()) +
+ Whoops! There were some problems with your input.

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ @csrf + + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + +
+ +
+
+ +
+
+
+
+
+
+
+
diff --git a/resources/views/projects/edit.blade.php b/resources/views/projects/edit.blade.php new file mode 100644 index 0000000..564daa6 --- /dev/null +++ b/resources/views/projects/edit.blade.php @@ -0,0 +1,89 @@ +@push('head') + + + + + +@endpush + + + +
+ + Back + +

Edit Project

+
+
+ +
+
+
+
+ +
+
+

Edit Project

+
+
+ + +
+
+ @if ($errors->any()) +
+ Whoops! There were some problems with your input.

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ @csrf + @method('PUT') + + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + +
+ +
+
+ +
+
+
+
+
+
+
+
diff --git a/resources/views/projects/index.blade.php b/resources/views/projects/index.blade.php new file mode 100644 index 0000000..1a855a7 --- /dev/null +++ b/resources/views/projects/index.blade.php @@ -0,0 +1,114 @@ + + +
+

+ {{ __('Project Management') }} +

+ +
+
+ + + + + + Projects + + + + + + + + +
+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @endif +
+ + + + + + + + + + @foreach ($projects as $project) + + + + + + @endforeach + +
NAMEDETAILSACTION
{{ $project->name }}{{ $project->detail }} +
+ + +
+ @csrf + @method('DELETE') + +
+
+
+
+
+ {{ $projects->links() }} +
+
+ + + + + + + + + + +
diff --git a/resources/views/projects/layout.blade.php b/resources/views/projects/layout.blade.php new file mode 100644 index 0000000..c0dbfb6 --- /dev/null +++ b/resources/views/projects/layout.blade.php @@ -0,0 +1,15 @@ + + + + Project Management + + + + +
+
+ @yield('content') +
+ + + diff --git a/resources/views/projects/show.blade.php b/resources/views/projects/show.blade.php new file mode 100644 index 0000000..988cd2f --- /dev/null +++ b/resources/views/projects/show.blade.php @@ -0,0 +1,72 @@ +@push('head') + + + + + +@endpush + + + +
+ + Back + +

+ Show Project +

+
+
+ +
+
+
+
+ +
+
+

Show Project

+
+
+ + +
+
+
+
+

+
+
+
+ + + + + + + + + + + +
Name:{{ $project->name }}
Details:{{ $project->detail }}
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/views/welcome1.blade.php b/resources/views/welcome1.blade.php new file mode 100644 index 0000000..e305e33 --- /dev/null +++ b/resources/views/welcome1.blade.php @@ -0,0 +1,132 @@ + + + + + + + Laravel + + + + + + + + + + +
+ @if (Route::has('login')) + + @endif + +
+
+ + + + + +
+ +
+
+
+ + +
+
+ Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end. +
+
+
+ +
+
+ + +
+ +
+
+ Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. +
+
+
+ +
+
+ + +
+ +
+
+ Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials. +
+
+
+ +
+
+ +
Vibrant Ecosystem
+
+ +
+
+ Laravel's robust library of first-party tools and libraries, such as Forge, Vapor, Nova, and Envoyer help you take your projects to the next level. Pair them with powerful open source libraries like Cashier, Dusk, Echo, Horizon, Sanctum, Telescope, and more. +
+
+
+
+
+ +
+
+
+ + + + + + Shop + + + + + + + + Sponsor + +
+
+ +
+ Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) +
+
+
+
+ + diff --git a/routes/web.php b/routes/web.php index 0b37cfd..344eb31 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,6 +4,8 @@ use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\UserController; +use App\Http\Controllers\ProductController; + /* |-------------------------------------------------------------------------- @@ -27,7 +29,7 @@ Route::get('/admin/usermanagement',[UserController::class,'index'])->middleware('admin'); -Route::get('/admin/projects', function () { +Route::get('/admin/project', function () { return view('projectlists'); })->middleware('admin'); @@ -41,7 +43,11 @@ return view('contact'); }); + + Route::view('admin/associate-form','associate-form')->middleware('admin'); Route::post('/admin/save-associate','App\Http\Controllers\AssociateController@save')->middleware('admin'); Route::get('/admin/associates-list','App\Http\Controllers\AssociateController@index')->middleware('admin'); +Route::get('/admin/projects', [ProjectController::class, 'index']); +Route::resource('projects', ProjectController::class);