Primer commit proyecto Laravel
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
||||
use Laravel\Jetstream\Jetstream;
|
||||
|
||||
class CreateNewUser implements CreatesNewUsers
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
||||
/**
|
||||
* Validate and create a newly registered user.
|
||||
*
|
||||
* @param array<string, string> $input
|
||||
*/
|
||||
public function create(array $input): User
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => $this->passwordRules(),
|
||||
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
|
||||
])->validate();
|
||||
|
||||
return User::create([
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
'password' => Hash::make($input['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
trait PasswordValidationRules
|
||||
{
|
||||
/**
|
||||
* Get the validation rules used to validate passwords.
|
||||
*
|
||||
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
|
||||
*/
|
||||
protected function passwordRules(): array
|
||||
{
|
||||
return ['required', 'string', Password::default(), 'confirmed'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Laravel\Fortify\Contracts\ResetsUserPasswords;
|
||||
|
||||
class ResetUserPassword implements ResetsUserPasswords
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
||||
/**
|
||||
* Validate and reset the user's forgotten password.
|
||||
*
|
||||
* @param array<string, string> $input
|
||||
*/
|
||||
public function reset(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'password' => $this->passwordRules(),
|
||||
])->validate();
|
||||
|
||||
$user->forceFill([
|
||||
'password' => Hash::make($input['password']),
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
|
||||
|
||||
class UpdateUserPassword implements UpdatesUserPasswords
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
||||
/**
|
||||
* Validate and update the user's password.
|
||||
*
|
||||
* @param array<string, string> $input
|
||||
*/
|
||||
public function update(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'current_password' => ['required', 'string', 'current_password:web'],
|
||||
'password' => $this->passwordRules(),
|
||||
], [
|
||||
'current_password.current_password' => __('The provided password does not match your current password.'),
|
||||
])->validateWithBag('updatePassword');
|
||||
|
||||
$user->forceFill([
|
||||
'password' => Hash::make($input['password']),
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
||||
|
||||
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
{
|
||||
/**
|
||||
* Validate and update the given user's profile information.
|
||||
*
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
public function update(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
|
||||
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
|
||||
])->validateWithBag('updateProfileInformation');
|
||||
|
||||
if (isset($input['photo'])) {
|
||||
$user->updateProfilePhoto($input['photo']);
|
||||
}
|
||||
|
||||
if ($input['email'] !== $user->email &&
|
||||
$user instanceof MustVerifyEmail) {
|
||||
$this->updateVerifiedUser($user, $input);
|
||||
} else {
|
||||
$user->forceFill([
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given verified user's profile information.
|
||||
*
|
||||
* @param array<string, string> $input
|
||||
*/
|
||||
protected function updateVerifiedUser(User $user, array $input): void
|
||||
{
|
||||
$user->forceFill([
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
'email_verified_at' => null,
|
||||
])->save();
|
||||
|
||||
$user->sendEmailVerificationNotification();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Jetstream;
|
||||
|
||||
use App\Models\User;
|
||||
use Laravel\Jetstream\Contracts\DeletesUsers;
|
||||
|
||||
class DeleteUser implements DeletesUsers
|
||||
{
|
||||
/**
|
||||
* Delete the given user.
|
||||
*/
|
||||
public function delete(User $user): void
|
||||
{
|
||||
$user->deleteProfilePhoto();
|
||||
$user->tokens->each->delete();
|
||||
$user->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Models\Area;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class AreaController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:area.index')->only('index','show');
|
||||
$this->middleware('can:area.create')->only('create','store');
|
||||
$this->middleware('can:area.edit')->only('edit','update');
|
||||
$this->middleware('can:area.destroy')->only('destroy');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$areas = Area::all();
|
||||
return view('area.index',compact('areas'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$roles = Role::all();
|
||||
return view('area.create',compact('roles'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$area = Area::create($request->except(['roles']));
|
||||
|
||||
$area->areas()->sync($request->roles);
|
||||
|
||||
return redirect()->route('area.edit',$area)->with('info','El área se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(area $area)
|
||||
{
|
||||
return view('area.show',compact('area'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(area $area)
|
||||
{
|
||||
$roles = Role::all();
|
||||
return view('area.edit',compact('area','roles'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, area $area)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$area->update($request->except(['roles']));
|
||||
|
||||
$area->areas()->sync($request->roles);
|
||||
|
||||
return redirect()->route('area.edit',$area)->with('info','El área se actualizo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(area $area)
|
||||
{
|
||||
$area->areas()->detach();
|
||||
$area->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('area.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Campan;
|
||||
use Illuminate\View\View;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class CampanController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:campan.index')->only('index','show');
|
||||
$this->middleware('can:campan.create')->only('create','store');
|
||||
$this->middleware('can:campan.edit')->only('edit','update');
|
||||
$this->middleware('can:campan.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$campans = Campan::all();
|
||||
return view('campan.index',compact('campans'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('campan.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$campan = Campan::create($request->all());
|
||||
return redirect()->route('campan.edit',compact('campan'))->with('info','Se creó la campaña correctamente');
|
||||
}
|
||||
|
||||
public function edit(Campan $campan)
|
||||
{
|
||||
return view('campan.edit',compact('campan'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Campan $campan)
|
||||
{
|
||||
$campan ->update($request->all());
|
||||
return redirect()->route('campan.edit',compact('campan'))->with('info','Se modificó la campaña correctamente');
|
||||
}
|
||||
|
||||
public function show(Campan $campan)
|
||||
{
|
||||
return view('campan.show',compact('campan'));
|
||||
}
|
||||
|
||||
public function destroy(Campan $campan)
|
||||
{
|
||||
$campan ->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('campan.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Carrera;
|
||||
use App\Models\Nivel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class CarreraController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:carrera.index')->only('index','show');
|
||||
$this->middleware('can:carrera.create')->only('create','store');
|
||||
$this->middleware('can:carrera.edit')->only('edit','update');
|
||||
$this->middleware('can:carrera.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$carreras=Carrera::all();
|
||||
return view('carrera.index',compact('carreras'));
|
||||
}
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
$nivels=Nivel::where('status','=','1')->get();
|
||||
return view('carrera.create',compact('nivels'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request,Carrera $carrera)
|
||||
{
|
||||
$carrera= Carrera::create($request->all());
|
||||
return redirect()->route('carrera.edit',compact('carrera'))->with('info','Se creo la carrera correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Carrera $carrera)
|
||||
{
|
||||
return view('carrera.show',compact('carrera'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Carrera $carrera)
|
||||
{
|
||||
$nivels=Nivel::where('status','=','1')->get();
|
||||
return view('carrera.edit',compact('carrera','nivels'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Carrera $carrera)
|
||||
{
|
||||
$carrera->update($request->all());
|
||||
$nivels=Nivel::all();
|
||||
return redirect()->route('carrera.edit',compact('carrera','nivels'))->with('info','Se editó la carrera correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Carrera $carrera)
|
||||
{
|
||||
$carrera->carreraMaterial()->detach();
|
||||
$carrera->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('carrera.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Concepto;
|
||||
use App\Models\Plane;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\View\View;
|
||||
|
||||
use function Symfony\Component\Clock\now;
|
||||
|
||||
class ConceptoController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:concepto.index')->only('index','show');
|
||||
$this->middleware('can:concepto.create')->only('create','store');
|
||||
$this->middleware('can:concepto.edit')->only('edit','update');
|
||||
$this->middleware('can:concepto.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$conceptos = Concepto::where('tipo','=','3')->get();
|
||||
return view('concepto.index',compact('conceptos'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('concepto.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
if($request->plane != 0){
|
||||
$concepto =Concepto::create($request->except(['plane']));
|
||||
$concepto->planConceptos()->sync($request->plane);
|
||||
$plane= Plane::where('id','=',$request->plane)->first();
|
||||
return redirect()->route('plane.edit',compact('plane'))->with('info','Se anexó el concepto');
|
||||
}else{
|
||||
$concepto =Concepto::create([
|
||||
'name' => $request->name,
|
||||
'fecha_pago' => date('Y-m-d'),
|
||||
'monto' => 0,
|
||||
'recargo' => 0,
|
||||
'tipo' => 3
|
||||
]);
|
||||
return redirect()->route('concepto.edit',compact('concepto'))->with('info','Se creó el concepto');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function edit(Concepto $concepto)
|
||||
{
|
||||
|
||||
return view('concepto.edit',compact('concepto'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Concepto $concepto)
|
||||
{
|
||||
if($request->plane != 0 ){
|
||||
$concepto->update($request->except(['plane']));
|
||||
$concepto->planConceptos()->sync($request->plane);
|
||||
$plane= Plane::where('id','=',$request->plane)->first();
|
||||
return redirect()->route('plane.edit',compact('plane'))->with('info','Se modificó el concepto');
|
||||
|
||||
}else{
|
||||
$concepto->update([
|
||||
'name' => $request->name,
|
||||
'fecha_pago' => date('Y-m-d'),
|
||||
'monto' => 0,
|
||||
'recargo' => 0,
|
||||
'tipo' => 3
|
||||
]);
|
||||
return redirect()->route('concepto.edit',compact('concepto'))->with('info','Se modificó el concepto');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function show(Concepto $concepto )
|
||||
{
|
||||
return view('concepto.show',compact('concepto'));
|
||||
}
|
||||
|
||||
public function destroy(Concepto $concepto,Request $request)
|
||||
{
|
||||
|
||||
if($request->plane != 0){
|
||||
$plane=$request->plane;
|
||||
$concepto->planConceptos()->detach();
|
||||
$concepto->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('plane.edit',compact('plane'));
|
||||
}else{
|
||||
$concepto->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('concepto.index');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Duration;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class DurationController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:duration.index')->only('index','show');
|
||||
$this->middleware('can:duration.create')->only('create','store');
|
||||
$this->middleware('can:duration.edit')->only('edit','update');
|
||||
$this->middleware('can:duration.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$durations = Duration::all();
|
||||
return view('duration.index',compact('durations'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('duration.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$duration =Duration::create($request->all());
|
||||
return redirect()->route('duration.edit',compact('duration'))->with('info','Se creó la duración correctamente');
|
||||
}
|
||||
|
||||
public function edit(Duration $duration )
|
||||
{
|
||||
return view('duration.edit',compact('duration'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Duration $duration )
|
||||
{
|
||||
$duration ->update($request->all());
|
||||
return redirect()->route('duration.edit',compact('duration'))->with('info','Se modificó la duración correctamente');
|
||||
}
|
||||
|
||||
public function show(Duration $duration )
|
||||
{
|
||||
return view('duration.show',compact('duration'));
|
||||
}
|
||||
|
||||
public function destroy(Duration $duration )
|
||||
{
|
||||
$duration ->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('duration.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Carrera;
|
||||
use App\Models\Material;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MaterialController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$material =Material::create($request->except(['carrera']));
|
||||
$material->carreraMaterial()->sync($request->carrera);
|
||||
$carrera= Carrera::where('id','=',$request->carrera)->first();
|
||||
return redirect()->route('carrera.edit',compact('carrera'))->with('infoMaterial','Se anexó el material');
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request,Material $material)
|
||||
{
|
||||
$material->update($request->except(['carrera']));
|
||||
$material->carreraMaterial()->sync($request->carrera);
|
||||
$carrera= Carrera::where('id','=',$request->carrera)->first();
|
||||
return redirect()->route('carrera.edit',compact('carrera'))->with('infoMaterial','Se modificó el material');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Material $material,Request $request)
|
||||
{
|
||||
|
||||
$carrera=$request->carrera;
|
||||
$material->carreraMaterial()->detach();
|
||||
$material->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('carrera.edit',compact('carrera'));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Medio;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
class MedioController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:medio.index')->only('index','show');
|
||||
$this->middleware('can:medio.create')->only('create','store');
|
||||
$this->middleware('can:medio.edit')->only('edit','update');
|
||||
$this->middleware('can:medio.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$medios = Medio::all();
|
||||
return view('medio.index',compact('medios'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('medio.create');
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$medio = Medio::create($request->all());
|
||||
return redirect()->route('medio.edit',$medio)->with('info','El medio se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Medio $medio)
|
||||
{
|
||||
|
||||
return view('medio.show',compact('medio'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Medio $medio)
|
||||
{
|
||||
return view('medio.edit',compact('medio'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Medio $medio)
|
||||
{
|
||||
$medio->update($request->all());
|
||||
return redirect()->route('medio.edit',$medio)->with('info','El medio se actualizo correctamente');
|
||||
}
|
||||
|
||||
public function destroy(Medio $medio)
|
||||
{
|
||||
$medio->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('medio.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Nivel;
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class NivelController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:nivel.index')->only('index','show');
|
||||
$this->middleware('can:nivel.create')->only('create','store');
|
||||
$this->middleware('can:nivel.edit')->only('edit','update');
|
||||
$this->middleware('can:nivel.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
$nivels = Nivel::all();
|
||||
return view('nivel.index',compact('nivels','plantels'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{$plantels = Plantel::where('status','=','1')->get();
|
||||
return view('nivel.create',compact('plantels'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$nivel = Nivel ::create($request->except(['plantels']));
|
||||
$nivel->nivelPlantel()->sync($request->plantels);
|
||||
return redirect()->route('nivel.edit',compact('nivel'))->with('info','Se creó el nivel correctamente');
|
||||
}
|
||||
|
||||
public function edit(Nivel $nivel)
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
return view('nivel.edit',compact('nivel','plantels'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Nivel $nivel )
|
||||
{
|
||||
$nivel ->update($request->except(['plantels']));
|
||||
$nivel->nivelPlantel()->sync($request->plantels);
|
||||
return redirect()->route('nivel.edit',compact('nivel'))->with('info','Se modificó el nivel correctamente');
|
||||
}
|
||||
|
||||
public function show(Nivel $nivel )
|
||||
{
|
||||
return view('nivel.show',compact('nivel'));
|
||||
}
|
||||
|
||||
public function destroy(Nivel $nivel )
|
||||
{
|
||||
$nivel ->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('nivel.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Note;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class NoteController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:note.index')->only('index','show');
|
||||
$this->middleware('can:note.create')->only('create','store');
|
||||
$this->middleware('can:note.edit')->only('edit','update');
|
||||
$this->middleware('can:note.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$notes = Note::all();
|
||||
return view('note.index',compact('notes'));
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('note.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$request['user_id']=$user->id;
|
||||
$note= Note::create($request->all());
|
||||
return redirect()->route('note.index',compact('note'))->with('info','Se creó la nota correctamente');
|
||||
}
|
||||
|
||||
public function edit(Note $note)
|
||||
{
|
||||
return view('note.edit',compact('note'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Note $note)
|
||||
{
|
||||
$note->update($request->all());
|
||||
return redirect()->route('note.edit',compact('note'))->with('info','Se creó la nota correctamente');
|
||||
}
|
||||
|
||||
public function show(Note $note)
|
||||
{
|
||||
return view('note.show',compact('note'));
|
||||
}
|
||||
|
||||
public function destroy(Note $note)
|
||||
{
|
||||
$note->delete();
|
||||
return redirect()->route('note.index');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Pago;
|
||||
use App\Models\Concepto;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class PagoController extends Controller
|
||||
{
|
||||
// public function __construct() {
|
||||
// $this->middleware('can:user.index')->only('index');
|
||||
// }
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$prospectoId = $user->prospectos()->value('prospectos.id');
|
||||
|
||||
$pagos = Pago::where('user_id', $prospectoId)->get();
|
||||
|
||||
$nombres = Concepto::where('tipo', '3')->get();
|
||||
|
||||
return view('pago.index',compact('pagos','nombres'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Guard;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class PermissionController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:permission.index')->only('index','show');
|
||||
$this->middleware('can:permission.create')->only('create','store');
|
||||
$this->middleware('can:permission.edit')->only('edit','update');
|
||||
$this->middleware('can:permission.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$permissions = Permission::all();
|
||||
return view('permission.index',compact('permissions'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('permission.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$request['guard_name'] ??= Guard::getDefaultName(static::class);
|
||||
|
||||
$permission= Permission::create($request->all());
|
||||
|
||||
Artisan::call('cache:clear');
|
||||
|
||||
return redirect()->route('permission.edit',compact('permission'))->with('info', 'Permiso creado exitosamente.');
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->route('permission.create')->with('info', 'Falta algun dato o el permiso ya se encuentra creado.');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function show(Permission $permission)
|
||||
{
|
||||
return view('permission.show',compact('permission'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Permission $permission)
|
||||
{
|
||||
return view('permission.edit',compact('permission'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Permission $permission)
|
||||
{
|
||||
$permission->update($request->all());
|
||||
return redirect()->route('permission.edit',compact('permission'))->with('info','Se modificó el permiso correctamente');
|
||||
}
|
||||
|
||||
public function destroy(Permission $permission)
|
||||
{
|
||||
$permission->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('permission.index');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Duration;
|
||||
use App\Models\Plan;
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class PlanController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:plan.index')->only('index','show');
|
||||
$this->middleware('can:plan.create')->only('create','store');
|
||||
$this->middleware('can:plan.edit')->only('edit','update');
|
||||
$this->middleware('can:plan.destroy')->only('destroy');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$plans = Plan::all();
|
||||
return view('plan.index',compact('plans'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
$durations = Duration::all();
|
||||
return view('plan.create',compact('plantels','durations'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
// dd($request);
|
||||
|
||||
$plan = Plan::create($request->except(['plantels']));
|
||||
|
||||
$plan->planesPlantel()->sync($request->plantels);
|
||||
|
||||
return redirect()->route('plan.edit',$plan)->with('info','El plan se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Plan $plan)
|
||||
{
|
||||
return view('plan.show',compact('plan'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Plan $plan)
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
$durations = Duration::all();
|
||||
return view('plan.edit',compact('plantels','durations','plan'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Plan $plan)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$plan->update($request->except(['plantels']));
|
||||
|
||||
$plan->planesPlantel()->sync($request->plantels);
|
||||
|
||||
return redirect()->route('plan.edit',$plan)->with('info','El plan se actualizo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Plan $plan)
|
||||
{
|
||||
$plan->planesPlantel()->detach();
|
||||
$plan->delete();
|
||||
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('plan.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Plane;
|
||||
use App\Models\Plantel;
|
||||
use App\Models\Concepto;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class PlaneController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:plane.index')->only('index','show');
|
||||
$this->middleware('can:plane.create')->only('create','store');
|
||||
$this->middleware('can:plane.edit')->only('edit','update');
|
||||
$this->middleware('can:plane.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$planes=Plane::all();
|
||||
return view('plane.index',compact('planes'));
|
||||
}
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
$plantels=Plantel::where('status','=','1')->get();
|
||||
return view('plane.create',compact('plantels'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$plane = Plane::create($request->all());
|
||||
|
||||
return redirect()->route('plane.edit',$plane)->with('info','El plan se creo correctamente');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function show(Plane $plane)
|
||||
{
|
||||
return view('plane.show',compact('plane'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Plane $plane)
|
||||
{ $planConceptos = $plane->conceptos;
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
$conceptos = Concepto::where('tipo','=','3')->get();
|
||||
|
||||
return view('plane.edit',compact('plane','plantels','conceptos','planConceptos'));
|
||||
}
|
||||
|
||||
public function update(Request $request,Plane $plane)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$plane->update($request->except(['plantels']));
|
||||
|
||||
$plane->planPlantel()->sync($request->plantels);
|
||||
|
||||
return redirect()->route('plane.edit',$plane)->with('info','El plan se actualizo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Plane $plane)
|
||||
{
|
||||
$plane->planPlantel()->detach();
|
||||
$plane->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('plane.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class PlantelController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:plantel.index')->only('index','show');
|
||||
$this->middleware('can:plantel.create')->only('create','store');
|
||||
$this->middleware('can:plantel.edit')->only('edit','update');
|
||||
$this->middleware('can:plantel.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$plantels = Plantel::all();
|
||||
return view('plantel.index',compact('plantels'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('plantel.create');
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$plantel = Plantel::create($request->all());
|
||||
|
||||
return redirect()->route('plantel.edit',$plantel)->with('info','El plantel se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Plantel $plantel)
|
||||
{
|
||||
return view('plantel.show',compact('plantel'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Plantel $plantel)
|
||||
{
|
||||
return view('plantel.edit',compact('plantel'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Plantel $plantel)
|
||||
{
|
||||
$plantel->update($request->all());
|
||||
|
||||
return redirect()->route('plantel.edit',$plantel)->with('info','El plantel se actualizo correctamente');
|
||||
}
|
||||
|
||||
public function destroy(Plantel $plantel)
|
||||
{
|
||||
$plantel->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('plantel.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Nivel;
|
||||
use App\Models\Prospecto;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
|
||||
class ProspectoController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('can:prospecto.index')->only('index','show');
|
||||
$this->middleware('can:prospecto.create')->only('create','store');
|
||||
$this->middleware('can:prospecto.edit')->only('edit','update');
|
||||
$this->middleware('can:prospecto.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$prospectos = User::with(['prospectos' => function ($query) use ($user) {
|
||||
$query->where('usuario_registro', $user->id);
|
||||
}])
|
||||
->whereHas('prospectos', function ($query) use ($user) {
|
||||
$query->where('usuario_registro', $user->id);
|
||||
})
|
||||
->get();
|
||||
|
||||
return view('prospecto.index', compact('prospectos'));
|
||||
}
|
||||
|
||||
public function destroy(Prospecto $prospecto)
|
||||
{
|
||||
$user = $prospecto->prospectos()->first();
|
||||
|
||||
if ($user) {
|
||||
$user->roles()->detach();
|
||||
|
||||
$user->plantelUsuarios()->detach();
|
||||
|
||||
$prospecto->prospectos()->detach($user->id);
|
||||
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
$prospecto->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('prospecto.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:role.index')->only('index','show');
|
||||
$this->middleware('can:role.create')->only('create','store');
|
||||
$this->middleware('can:role.edit')->only('edit','update');
|
||||
$this->middleware('can:role.destroy')->only('destroy');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$roles = Role::all();
|
||||
return view('role.index',compact('roles'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$permissions = Permission::all();
|
||||
return view('role.create',compact('permissions'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$role = Role::create($request->all());
|
||||
|
||||
$role->permissions()->sync($request->permissions);
|
||||
|
||||
return redirect()->route('role.edit',$role)->with('info','El rol se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Role $role)
|
||||
{
|
||||
return view('role.show',compact('role'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Role $role)
|
||||
{
|
||||
$permissions = Permission::all();
|
||||
return view('role.edit',compact('role','permissions'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Role $role)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$role->update($request->all());
|
||||
|
||||
$role->permissions()->sync($request->permissions);
|
||||
|
||||
return redirect()->route('role.edit',$role)->with('info','El rol se actualizo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Role $role)
|
||||
{
|
||||
$role->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('role.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Concepto;
|
||||
use App\Models\Pago;
|
||||
use Stripe\Stripe;
|
||||
use Stripe\Checkout\Session;
|
||||
|
||||
class StripeController extends Controller
|
||||
{
|
||||
public function pagar(Pago $pago)
|
||||
{
|
||||
$concepto = Concepto::where('id', $pago->concepto)->first();
|
||||
|
||||
Stripe::setApiKey(config('services.stripe.secret'));
|
||||
|
||||
$session = Session::create([
|
||||
'mode' => 'payment',
|
||||
'line_items' => [[
|
||||
'price_data' => [
|
||||
'currency' => 'mxn',
|
||||
'product_data' => [
|
||||
'name' => $concepto->name,
|
||||
],
|
||||
'unit_amount' => $pago->monto * 100,
|
||||
],
|
||||
'quantity' => 1,
|
||||
]],
|
||||
'success_url' => route('pagar.show',1),
|
||||
'cancel_url' => route('pagar.show',0),
|
||||
'metadata' => [
|
||||
'pago_id' => $pago->id,
|
||||
],
|
||||
]);
|
||||
|
||||
return redirect()->away($session->url);
|
||||
}
|
||||
|
||||
public function show($status)
|
||||
{
|
||||
if ($status == 1) {
|
||||
session()->flash('swal', [
|
||||
'icon' => 'success',
|
||||
'title' => 'Pago en proceso',
|
||||
'text' => 'Estamos validando tu pago'
|
||||
]);
|
||||
} else {
|
||||
session()->flash('swal', [
|
||||
'icon' => 'error',
|
||||
'title' => 'Pago cancelado',
|
||||
'text' => 'No se realizó ningún cargo'
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('pago.index');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Pago;
|
||||
use Illuminate\Http\Request;
|
||||
use Stripe\Webhook;
|
||||
use Stripe\Exception\SignatureVerificationException;
|
||||
|
||||
class StripeWebhookController extends Controller
|
||||
{
|
||||
public function handle(Request $request)
|
||||
{
|
||||
$payload = $request->getContent();
|
||||
$signature = $request->header('Stripe-Signature');
|
||||
$secret = config('services.stripe.webhook_secret');
|
||||
|
||||
try {
|
||||
$event = Webhook::constructEvent(
|
||||
$payload,
|
||||
$signature,
|
||||
$secret
|
||||
);
|
||||
} catch (SignatureVerificationException $e) {
|
||||
return response('Firma inválida', 400);
|
||||
}
|
||||
|
||||
// 👉 Evento que nos importa
|
||||
if ($event->type === 'checkout.session.completed') {
|
||||
|
||||
$session = $event->data->object;
|
||||
|
||||
$pagoId = $session->metadata->pago_id ?? null;
|
||||
|
||||
if ($pagoId) {
|
||||
Pago::where('id', $pagoId)->update([
|
||||
'estado' => 'pagado',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return response('OK', 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Turno;
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class TurnoController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:turno.index')->only('index','show');
|
||||
$this->middleware('can:turno.create')->only('create','store');
|
||||
$this->middleware('can:turno.edit')->only('edit','update');
|
||||
$this->middleware('can:turno.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$turnos = Turno::all();
|
||||
return view('turno.index',compact('turnos'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
return view('turno.create',compact('plantels'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name'=>'required'
|
||||
]);
|
||||
|
||||
$turno = Turno::create($request->except(['plantels']));
|
||||
$turno->turnoPlantel()->sync($request->plantels);
|
||||
return redirect()->route('turno.edit',$turno)->with('info','El turno se creo correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(Turno $turno)
|
||||
{
|
||||
|
||||
return view('turno.show',compact('turno'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Turno $turno)
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
return view('turno.edit',compact('turno','plantels'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, Turno $turno)
|
||||
{
|
||||
$turno->update($request->except(['plantels']));
|
||||
$turno->turnoPlantel()->sync($request->plantels);
|
||||
return redirect()->route('turno.edit',$turno)->with('info','El turno se actualizo correctamente');
|
||||
}
|
||||
|
||||
public function destroy(Turno $turno)
|
||||
{
|
||||
$turno->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('turno.index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use App\Models\Plantel;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('can:user.index')->only('index','show');
|
||||
$this->middleware('can:user.create')->only('create','store');
|
||||
$this->middleware('can:user.edit')->only('edit','update');
|
||||
$this->middleware('can:user.destroy')->only('destroy');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$plantels=Plantel::all();
|
||||
$users=User::with('roles')->get();
|
||||
return view('user.index',compact('users','plantels'));
|
||||
}
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
$plantels = Plantel::where('status','=','1')->get();
|
||||
$roles= Role::all();
|
||||
return view('user.create',compact('roles','plantels'));
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request,User $user)
|
||||
{
|
||||
$user= User::create($request->except(['plantels']));
|
||||
$user->roles()->sync($request->roles);
|
||||
|
||||
$user->plantelUsuarios()->sync($request->plantels);
|
||||
|
||||
return redirect()->route('user.edit',compact('user'))->with('info','Se creó el usuario correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function show(User $user)
|
||||
{
|
||||
return view('user.show',compact('user'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(User $user)
|
||||
{
|
||||
$plantels=Plantel::all();
|
||||
$roles= Role::all();
|
||||
return view('user.edit',compact('user','roles','plantels'));
|
||||
}
|
||||
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
$user->update($request->except(['plantels']));
|
||||
$user->roles()->sync($request->roles);
|
||||
$user->plantelUsuarios()->sync($request->plantels);
|
||||
return redirect()->route('user.edit',compact('user'))->with('info','Se modifico el usuario correctamente');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(User $user)
|
||||
{
|
||||
$user->plantelUsuarios()->detach();
|
||||
$user->delete();
|
||||
session()->flash('swal',[
|
||||
'icon'=>'success',
|
||||
'title'=>'Eliminado!',
|
||||
'text'=>'Se ha eliminado el registro correctamente'
|
||||
]);
|
||||
return redirect()->route('user.index');
|
||||
}
|
||||
|
||||
public function profile(){
|
||||
return view('profile.show');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Carrera;
|
||||
use App\Models\Nivel;
|
||||
use App\Models\Plan;
|
||||
use Livewire\Component;
|
||||
|
||||
class Carreras extends Component
|
||||
{
|
||||
public $niveles;
|
||||
public $selectedNivel = null;
|
||||
public $carreras = [];
|
||||
public $selectedCarrera = null;
|
||||
public Plan $plan;
|
||||
|
||||
public function mount(Plan $plan)
|
||||
{
|
||||
$this->plan = $plan;
|
||||
|
||||
$this->niveles = Nivel::all();
|
||||
|
||||
$this->selectedNivel = (int) $plan->nivel;
|
||||
$this->selectedCarrera = (int) $plan->carrera;
|
||||
|
||||
$this->carreras = Carrera::where('nivel', $this->selectedNivel)->get();
|
||||
}
|
||||
|
||||
|
||||
// Este método se ejecuta cuando $selectedCountry cambia
|
||||
public function updatedSelectedNivel($nivel)
|
||||
{
|
||||
$this->carreras = Carrera::where('nivel','=', $nivel)->get();
|
||||
$this->selectedCarrera = null; // Reiniciar ciudad al cambiar país
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.carreras');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Livewire\Component;
|
||||
use App\Models\Concepto;
|
||||
|
||||
use Livewire\Attributes\On;
|
||||
use App\Models\TipoConcepto;
|
||||
|
||||
class Conceptos extends Component
|
||||
{
|
||||
public $concepto = null;
|
||||
public $fecha_pago = null;
|
||||
public $plane;
|
||||
|
||||
#[On('edit-concepto')]
|
||||
public function editMaterial($id)
|
||||
{
|
||||
$this->concepto = Concepto::findOrFail($id);
|
||||
$this->fecha_pago = $this->concepto->fecha_pago
|
||||
? Carbon::parse($this->concepto->fecha_pago)->format('Y-m-d')
|
||||
: null;
|
||||
$this->dispatch('open-concepto-modal');
|
||||
}
|
||||
|
||||
#[On('create-concepto')]
|
||||
public function createMaterial()
|
||||
{
|
||||
$this->reset('concepto');
|
||||
$this->dispatch('open-concepto-modal');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.conceptos', [
|
||||
'tipos'=> TipoConcepto::where('id','!=','3')->get(),
|
||||
'conceptos'=> Concepto::where('tipo','=','3')->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Pago;
|
||||
use App\Models\Plan;
|
||||
use App\Models\Medio;
|
||||
use App\Models\Nivel;
|
||||
use App\Models\Plane;
|
||||
use App\Models\Turno;
|
||||
use App\Models\Campan;
|
||||
use App\Models\Plantel;
|
||||
use Livewire\Component;
|
||||
use App\Models\Concepto;
|
||||
use App\Models\Prospecto;
|
||||
use Livewire\Attributes\On;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class DataProspecto extends Component
|
||||
{
|
||||
public $full;
|
||||
|
||||
public $activeProspectId = null;
|
||||
|
||||
public $pname;
|
||||
public $pemail;
|
||||
public $ptelefono;
|
||||
public $pdireccion;
|
||||
public $ppassword;
|
||||
public $pplantels;
|
||||
public $proles;
|
||||
|
||||
public $selectedNivel;
|
||||
public $selectedplan;
|
||||
public $selectedplane;
|
||||
public $pciclo;
|
||||
public $pturno;
|
||||
public $pmedio;
|
||||
|
||||
|
||||
public $niveles = [];
|
||||
public $plans = [];
|
||||
public $turnos = [];
|
||||
|
||||
public $planesPago = [];
|
||||
public $conceptos = [];
|
||||
public $conceptosNombres = [];
|
||||
|
||||
public $active = "disabled";
|
||||
|
||||
public $prospecto = null;
|
||||
|
||||
public function failedValidation(ValidationException $e)
|
||||
{
|
||||
$this->dispatch('swal',
|
||||
icon: 'error',
|
||||
title: 'Error de validación',
|
||||
text: $e->validator->errors()->first(),
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
public function updatedPplantels()
|
||||
{
|
||||
$this->selectedNivel = null;
|
||||
$this->selectedplan = null;
|
||||
$this->plans = [];
|
||||
|
||||
$this->niveles = Nivel::whereHas('nivelPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->turnos = Turno::whereHas('turnoPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
}
|
||||
|
||||
public function updatedSelectedNivel()
|
||||
{
|
||||
if (!$this->selectedNivel || !$this->pplantels) {
|
||||
$this->plans = [];
|
||||
$this->active = "disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
$this->plans = Plan::where('nivel', $this->selectedNivel)
|
||||
->whereHas('planesPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->active = "";
|
||||
}
|
||||
|
||||
public function updatedSelectedplane()
|
||||
{
|
||||
$this->conceptos = [];
|
||||
|
||||
if (!$this->selectedplane) {
|
||||
return;
|
||||
}
|
||||
|
||||
// $plane = Plane::with(['conceptos' => function ($query) {
|
||||
// $query->where('tipo', 1);
|
||||
// }])->find($this->selectedplane);
|
||||
|
||||
$plane = Plane::with('conceptos')->find($this->selectedplane);
|
||||
|
||||
if ($plane) {
|
||||
$this->conceptos = $plane->conceptos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function actualizarProspecto()
|
||||
{
|
||||
$user = $this->prospecto->prospectos()->first();
|
||||
if (!$user) return;
|
||||
|
||||
try {
|
||||
|
||||
$this->validate([
|
||||
'pname' => 'required',
|
||||
|
||||
'pemail' => [
|
||||
'required',
|
||||
'email',
|
||||
Rule::unique('users', 'email')->ignore($user->id),
|
||||
],
|
||||
|
||||
'ptelefono' => [
|
||||
'required',
|
||||
'regex:/^[0-9]{10}$/',
|
||||
Rule::unique('users', 'telefono')->ignore($user->id),
|
||||
],
|
||||
|
||||
], [
|
||||
'pname.required' => 'El nombre es obligatorio',
|
||||
'pemail.required' => 'El correo es obligatorio',
|
||||
'pemail.email' => 'El correo no es válido',
|
||||
'pemail.unique' => 'Este correo ya está registrado',
|
||||
|
||||
'ptelefono.required' => 'El teléfono es obligatorio',
|
||||
'ptelefono.regex' => 'El teléfono debe tener 10 dígitos numéricos',
|
||||
'ptelefono.unique' => 'Este teléfono ya está registrado',
|
||||
]);
|
||||
|
||||
} catch (ValidationException $e) {
|
||||
|
||||
|
||||
$mensaje = collect($e->validator->errors()->all())->first();
|
||||
|
||||
$this->dispatch('swal',
|
||||
icon: 'error',
|
||||
title: 'Error de validación',
|
||||
text: $mensaje,
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user->update([
|
||||
'name' => $this->pname,
|
||||
'email' => $this->pemail,
|
||||
'telefono' => $this->ptelefono,
|
||||
'direccion' => $this->pdireccion,
|
||||
]);
|
||||
|
||||
$user->plantelUsuarios()->sync([$this->pplantels]);
|
||||
|
||||
$this->prospecto->update([
|
||||
'nivel' => $this->selectedNivel,
|
||||
'plan_id' => $this->selectedplan,
|
||||
'ciclo' => $this->pciclo,
|
||||
'turno' => $this->pturno,
|
||||
'medio' => $this->pmedio,
|
||||
]);
|
||||
|
||||
|
||||
$this->dispatch('swal',
|
||||
icon: 'success',
|
||||
title: 'Datos actualizados!',
|
||||
text: 'Se modificaon los datos del prospecto',
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
}
|
||||
|
||||
#[On('edit-prospecto')]
|
||||
public function editProspecto($id)
|
||||
{
|
||||
$this->activeProspectId = $id;
|
||||
|
||||
$this->resetForm();
|
||||
|
||||
$this->prospecto = Prospecto::findOrFail($id);
|
||||
$user = $this->prospecto->prospectos()->first();
|
||||
if (!$user) return;
|
||||
|
||||
$this->pname = $user->name;
|
||||
$this->pemail = $user->email;
|
||||
$this->ptelefono = $user->telefono;
|
||||
$this->pdireccion = $user->direccion;
|
||||
$this->proles = $user->roles()->pluck('id')->first();
|
||||
$this->pplantels = $user->plantelUsuarios()->value('plantels.id');
|
||||
|
||||
$this->selectedNivel = $this->prospecto->nivel;
|
||||
$this->pciclo = $this->prospecto->ciclo;
|
||||
$this->pturno = $this->prospecto->turno;
|
||||
$this->pmedio = $this->prospecto->medio;
|
||||
|
||||
$this->selectedplane = $this->prospecto->plane_id;
|
||||
|
||||
$plane = Plane::with(['conceptos' => function ($query) {
|
||||
$query->where('tipo', 1);
|
||||
}])->find($this->selectedplane);
|
||||
|
||||
if ($plane) {
|
||||
$this->conceptos = $plane->conceptos;
|
||||
}
|
||||
|
||||
|
||||
$this->niveles = Nivel::whereHas('nivelPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->turnos = Turno::whereHas('turnoPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->plans = Plan::where('nivel', $this->selectedNivel)
|
||||
->whereHas('planesPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->planesPago = Plane::whereHas('planPlantel', function ($q) {
|
||||
$q->where('plantels.id', $this->pplantels);
|
||||
})->get();
|
||||
|
||||
$this->conceptosNombres = Concepto::where('tipo','=','3' )->get();
|
||||
|
||||
$this->full = true;
|
||||
$this->selectedplan = $this->prospecto->plan_id;
|
||||
$this->active = "";
|
||||
$this->dispatch('mark-active-prospect', id: $id);
|
||||
}
|
||||
|
||||
public function plan()
|
||||
{
|
||||
|
||||
|
||||
if($this->prospecto->plane_id != $this->selectedplane){
|
||||
|
||||
Pago::where('user_id', '=', $this->prospecto->id)->delete();
|
||||
|
||||
$this->prospecto->update([
|
||||
'plane_id' => $this->selectedplane,
|
||||
]);
|
||||
|
||||
$promotor = Auth::user();
|
||||
foreach($this->conceptos as $concepto){
|
||||
Pago::create([
|
||||
'plans_id' => $this->selectedplane,
|
||||
'folio' => 0,
|
||||
'concepto' => $concepto->name,
|
||||
'beca' => 0,
|
||||
'monto' => $concepto->monto,
|
||||
'fecha_pago' => $concepto->fecha_pago,
|
||||
'pago'=>0,
|
||||
'user_id'=> $this->prospecto->id,
|
||||
'asignacion' =>$promotor->id,
|
||||
'status'=> 1
|
||||
]);
|
||||
}
|
||||
|
||||
$this->dispatch('swal',
|
||||
icon: 'success',
|
||||
title: 'Éxito!',
|
||||
text: 'Plan de pago asignado',
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
|
||||
}else{
|
||||
|
||||
$this->dispatch('swal',
|
||||
icon: 'error',
|
||||
title: 'Error!',
|
||||
text: 'Plan de pago actualmente asignado',
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function resetForm()
|
||||
{
|
||||
// Usuario
|
||||
$this->pname = null;
|
||||
$this->pemail = null;
|
||||
$this->ptelefono = null;
|
||||
$this->pdireccion = null;
|
||||
$this->ppassword = null;
|
||||
$this->pplantels = null;
|
||||
$this->proles = null;
|
||||
|
||||
// Prospecto
|
||||
$this->selectedNivel = null;
|
||||
$this->selectedplan = null;
|
||||
$this->pciclo = null;
|
||||
$this->pturno = null;
|
||||
$this->pmedio = null;
|
||||
|
||||
// Selects
|
||||
$this->niveles = [];
|
||||
$this->plans = [];
|
||||
$this->turnos = [];
|
||||
|
||||
$this->active = "disabled";
|
||||
$this->prospecto = null;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.data-prospecto', [
|
||||
'roles' => Role::whereHas('areas', fn($q) => $q->where('areas.name', 'Promoción'))->get(),
|
||||
'plantels'=> Plantel::all(),
|
||||
'user' => Auth::user(),
|
||||
'campans' => Campan::all(),
|
||||
'medios' => Medio::all(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Material;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
class ModalMaterias extends Component
|
||||
{
|
||||
public $material = null;
|
||||
public $carrera;
|
||||
|
||||
#[On('edit-material')]
|
||||
public function editMaterial($id)
|
||||
{
|
||||
$this->material = Material::findOrFail($id);
|
||||
|
||||
$this->dispatch('open-material-modal');
|
||||
}
|
||||
|
||||
#[On('create-material')]
|
||||
public function createMaterial()
|
||||
{
|
||||
$this->reset('material');
|
||||
$this->dispatch('open-material-modal');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.modal-materias');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Campan;
|
||||
use App\Models\Medio;
|
||||
use App\Models\User;
|
||||
use App\Models\Nivel;
|
||||
use App\Models\Plan;
|
||||
use App\Models\Plantel;
|
||||
use App\Models\Prospecto;
|
||||
use App\Models\Turno;
|
||||
use Livewire\Component;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
class ModalProspecto extends Component
|
||||
{
|
||||
// Usuario
|
||||
public $pname;
|
||||
public $pemail;
|
||||
public $ptelefono;
|
||||
public $pdireccion;
|
||||
public $ppassword;
|
||||
public $pplantels;
|
||||
public $proles;
|
||||
|
||||
// Prospecto
|
||||
public $selectedNivel;
|
||||
public $selectedplan;
|
||||
public $pciclo;
|
||||
public $pturno;
|
||||
public $pmedio;
|
||||
|
||||
// Selects dependientes
|
||||
public $niveles = [];
|
||||
public $plans = [];
|
||||
public $turnos = [];
|
||||
|
||||
public $active = "disabled";
|
||||
|
||||
public $prospecto = null;
|
||||
|
||||
/* ------------------ RESET REAL ------------------ */
|
||||
private function resetForm()
|
||||
{
|
||||
$this->reset([
|
||||
'pname',
|
||||
'pemail',
|
||||
'ptelefono',
|
||||
'pdireccion',
|
||||
'ppassword',
|
||||
'pplantels',
|
||||
'proles',
|
||||
'selectedNivel',
|
||||
'selectedplan',
|
||||
'pciclo',
|
||||
'pturno',
|
||||
'pmedio',
|
||||
'prospecto',
|
||||
]);
|
||||
|
||||
$this->niveles = [];
|
||||
$this->plans = [];
|
||||
$this->turnos = [];
|
||||
$this->active = "disabled";
|
||||
}
|
||||
|
||||
/* ------------------ EDITAR ------------------ */
|
||||
|
||||
|
||||
/* ------------------ NUEVO ------------------ */
|
||||
#[On('create-prospecto')]
|
||||
public function createProspecto()
|
||||
{
|
||||
$this->resetForm();
|
||||
$this->dispatch('open-prospecto-modal');
|
||||
}
|
||||
|
||||
/* ------------------ SELECTS ------------------ */
|
||||
public function updatedPplantels()
|
||||
{
|
||||
$this->selectedNivel = null;
|
||||
$this->selectedplan = null;
|
||||
$this->plans = [];
|
||||
|
||||
$this->niveles = Nivel::whereHas('nivelPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->turnos = Turno::whereHas('turnoPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
}
|
||||
|
||||
public function updatedSelectedNivel()
|
||||
{
|
||||
if (!$this->selectedNivel || !$this->pplantels) {
|
||||
$this->plans = [];
|
||||
$this->active = "disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
$this->plans = Plan::where('nivel', $this->selectedNivel)
|
||||
->whereHas('planesPlantel', fn($q) =>
|
||||
$q->where('plantels.id', $this->pplantels)
|
||||
)->get();
|
||||
|
||||
$this->active = "";
|
||||
}
|
||||
|
||||
/* ------------------ GUARDAR ------------------ */
|
||||
public function guardarProspecto()
|
||||
{
|
||||
if (User::where('email', $this->pemail)
|
||||
->orWhere('telefono', $this->ptelefono)
|
||||
->exists()) {
|
||||
|
||||
$this->dispatch('swal:error', [
|
||||
'title' => 'Registro duplicado',
|
||||
'text' => 'El correo o teléfono ya están registrados.'
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::create([
|
||||
'name' => $this->pname,
|
||||
'email' => $this->pemail,
|
||||
'telefono' => $this->ptelefono,
|
||||
'direccion' => $this->pdireccion,
|
||||
'password' => Hash::make($this->ppassword),
|
||||
'status' => 1
|
||||
]);
|
||||
|
||||
$user->roles()->sync($this->proles);
|
||||
$user->plantelUsuarios()->sync([$this->pplantels]);
|
||||
|
||||
$prospecto = Prospecto::create([
|
||||
'nivel' => $this->selectedNivel,
|
||||
'plan_id' => $this->selectedplan,
|
||||
'usuario_registro' => Auth::id(),
|
||||
'ciclo' => $this->pciclo,
|
||||
'turno' => $this->pturno,
|
||||
'medio' => $this->pmedio,
|
||||
]);
|
||||
|
||||
$prospecto->prospectos()->sync([$user->id]);
|
||||
|
||||
$this->dispatch('swal:success');
|
||||
$this->dispatch('prospecto-creado');
|
||||
$this->resetForm();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------ RENDER ------------------ */
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.modal-prospecto', [
|
||||
'roles' => Role::whereHas('areas', fn($q) => $q->where('areas.name', 'Promoción'))->get(),
|
||||
'plantels'=> Plantel::all(),
|
||||
'user' => Auth::user(),
|
||||
'campans' => Campan::all(),
|
||||
'medios' => Medio::all(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Area extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function areas(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Role::class);
|
||||
}
|
||||
|
||||
public function existe($request = null)
|
||||
{
|
||||
if (!$request) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->areas()
|
||||
->wherePivot('role_id', $request)
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Campan extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Carrera extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function carreraMaterial() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Material::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Concepto extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function planConceptos() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plane::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Duration extends Model
|
||||
{
|
||||
protected $guarded=[];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Material extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
public function carreraMaterial() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Carrera::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Medio extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Nivel extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function nivelPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class)->withPivot('plantel_id');
|
||||
}
|
||||
|
||||
public function existe($plantelId = null)
|
||||
{
|
||||
if (!$plantelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->nivelPlantel()
|
||||
->wherePivot('plantel_id', $plantelId)
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Note extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Pago extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Plan extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function planesPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class)->withPivot('plantel_id');
|
||||
}
|
||||
|
||||
public function existe($plantelId = null)
|
||||
{
|
||||
if (!$plantelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->planesPlantel()
|
||||
->wherePivot('plantel_id', $plantelId)
|
||||
->exists();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Plane extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function planPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class)->withPivot('plantel_id');
|
||||
}
|
||||
|
||||
public function existe($plantelId = null)
|
||||
{
|
||||
if (!$plantelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->planPlantel()
|
||||
->wherePivot('plantel_id', $plantelId)
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function conceptos(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Concepto::class)
|
||||
->orderBy('conceptos.tipo', 'asc')
|
||||
->orderBy('conceptos.fecha_pago', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Plantel extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function planesPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plan::class);
|
||||
}
|
||||
|
||||
public function planPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plane::class);
|
||||
}
|
||||
|
||||
public function plantelUsuarios() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
public function nivelPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Nivel::class);
|
||||
}
|
||||
|
||||
public function turnoPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Turno::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Prospecto extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function plantelUsuarios(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class);
|
||||
}
|
||||
|
||||
public function existe($plantelId): bool
|
||||
{
|
||||
return $this->plantelUsuarios()
|
||||
->where('plantels.id', $plantelId)
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function prospectos() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ticket extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TipoConcepto extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Plantel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Turno extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function turnoPlantel() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class)->withPivot('plantel_id');
|
||||
}
|
||||
|
||||
public function existe($plantelId = null)
|
||||
{
|
||||
if (!$plantelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->turnoPlantel()
|
||||
->wherePivot('plantel_id', $plantelId)
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Laravel\Jetstream\HasProfilePhoto;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens;
|
||||
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory;
|
||||
use HasProfilePhoto;
|
||||
use Notifiable;
|
||||
use TwoFactorAuthenticatable;
|
||||
use HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'telefono',
|
||||
'direccion',
|
||||
'plantel',
|
||||
'password',
|
||||
'status',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
'two_factor_recovery_codes',
|
||||
'two_factor_secret',
|
||||
'status',
|
||||
];
|
||||
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $appends = [
|
||||
'profile_photo_url',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// public function note() : HasOne
|
||||
// {
|
||||
// //esta funcion es para retornar la relacion de un usario que contenga notas
|
||||
// return $this->hasOne(Note::class);
|
||||
// }
|
||||
|
||||
public function notes() : HasMany
|
||||
{
|
||||
return $this->hasMany(Note::class);
|
||||
}
|
||||
|
||||
public function pagos() : HasMany
|
||||
{
|
||||
return $this->hasMany(Pago::class);
|
||||
}
|
||||
|
||||
public function plantelUsuarios() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plantel::class)->withPivot('plantel_id');
|
||||
}
|
||||
|
||||
public function existe($request = null)
|
||||
{
|
||||
if (!$request) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->plantelUsuarios()
|
||||
->wherePivot('plantel_id', $request)
|
||||
->exists();
|
||||
}
|
||||
|
||||
|
||||
public function prospectos() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Prospecto::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Actions\Fortify\CreateNewUser;
|
||||
use App\Actions\Fortify\ResetUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserProfileInformation;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable;
|
||||
use Laravel\Fortify\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class FortifyServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Fortify::createUsersUsing(CreateNewUser::class);
|
||||
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
||||
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
|
||||
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
|
||||
Fortify::redirectUserForTwoFactorAuthenticationUsing(RedirectIfTwoFactorAuthenticatable::class);
|
||||
|
||||
Fortify::authenticateUsing(function (Request $request) {
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if (! $user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($user->status == 0) {
|
||||
throw ValidationException::withMessages([
|
||||
Fortify::username() => 'Tu cuenta ha sido desactivada. Contacta al administrador.'
|
||||
]);
|
||||
}
|
||||
|
||||
if (Hash::check($request->password, $user->password)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
RateLimiter::for('login', function (Request $request) {
|
||||
$throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip());
|
||||
|
||||
return Limit::perMinute(5)->by($throttleKey);
|
||||
});
|
||||
|
||||
RateLimiter::for('two-factor', function (Request $request) {
|
||||
return Limit::perMinute(5)->by($request->session()->get('login.id'));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Actions\Jetstream\DeleteUser;
|
||||
use Illuminate\Support\Facades\Vite;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Jetstream\Jetstream;
|
||||
|
||||
class JetstreamServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->configurePermissions();
|
||||
|
||||
Jetstream::deleteUsersUsing(DeleteUser::class);
|
||||
|
||||
Vite::prefetch(concurrency: 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the permissions that are available within the application.
|
||||
*/
|
||||
protected function configurePermissions(): void
|
||||
{
|
||||
Jetstream::defaultApiTokenPermissions(['read']);
|
||||
|
||||
Jetstream::permissions([
|
||||
'create',
|
||||
'read',
|
||||
'update',
|
||||
'delete',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.app');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class GuestLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.guest');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user