Category : model-view-controller

I have a form to register a student. The form submits when i use the following code <div class="text-xs-right"> <i class="ti-save-alt"></i> <input type="submit" class="btn btn-info btn-rounded mb-5" value="Register"> </div> But it just refreshes if i use the Button type Submit (below code) <button type="submit" value="Submit" class="btn btn-rounded btn-primary btn-outline"> <i class="ti-save-alt"></i> Register </button> Can someone ..

Read more

I have starter laravel app, when I access the login page, shows to me "This page isn’t working right now", I don’t see any errors in my code my loginController: <?php namespace AppHttpControllersAuth; use AppHttpControllersController; use IlluminateHttpRequest; class LoginController extends Controller { public function __construct() { $this->middleware([‘auth’]); } public function index(){ return view(‘auth.login’); } public ..

Read more

i am trying to pass button from controller to view here i tried this code function sendbutton (){ $order = 1; return ‘<a href="{{ url("user/order/geOrder/") . $order) }}" class="btn btn-primary" style="color:white">Edit Order</a>’ } it render successfully but problem is that my axpecting url should be "https://example.org/user/order/geOrder/1" but i am getting url https://example.org/user/order/create/Order/by/%7B%7B%20url( which is wrong ..

Read more

Undefined variable: blogcat (View: /home/techpriest/joseph/resources/views/admin/view_category.blade.php) this is my error message in laravel 8 but when I look at my code all seems well. here is my code. AdminController public function addBlogCat (Request $request){ if ($request->isMethod(‘post’)) { $data = $request->all(); $blogcat = new Foliocategories; $blogcat->name = $data[‘category_name’]; $blogcat->save(); return redirect (‘/blog/categories’); } return view (‘admin.view_category’); } ..

Read more

Hey i need to send data from my controller to view. Following is Route code when user type http://127.0.0.1:8000/About a controller will be activated. But an error is thrown and I have no clue what to do. Any hint or solution will be welcomed 🙂 Following is the code Route Route::get(‘About’,’[email protected]’); Controller <?php namespace AppHttpControllers; ..

Read more

I wanted to add comment to every post I make but I keep on getting errors. Comment Controller: public function store(Request $request) { $comments = new Comment; $comments->body =$request->get(‘comment_body’); $comments->user()->associate($request->user()); $blogs = Comment::find(1); $blogs->comments()->save($comments); return back(); } Comment Model: namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; class Comment extends Model { use HasFactory; protected $guarded =[]; ..

Read more

I am making an api to fetch all users of a group. And can’t get the below format of response using laravel resouces. This is Group Model. class Group extends Model { use SoftDeletes; protected $table = ‘groups’; protected $fillable = [‘name’, ‘short_name’, ‘description’, ‘settings’, ‘is_default’]; protected $casts = [ ‘settings’ => ‘array’, ]; public ..

Read more

I’m developing an e-commerce website using Laravel 8, And I tried to change on Laravel folders structure I’ve put views folder inside new path modules/admins which works fine, and I’ve also created a Models folder in the modules/admins path which works fine, however, I am having trouble with the controllers folder. I still have the ..

Read more

In this question I got a nice answer with some code. I now wonder what is the intended laravel way of implementing this. The code is: function getRoutesByGroup(array $group = []) { $list = Route::getRoutes()->getRoutes(); if (empty($group)) { return $list; } $routes = []; foreach ($list as $route) { $action = $route->getAction(); foreach ($group as ..

Read more

I’m using Laravel/Lumen and apparently it’s working fine, but the different routes are giving 500 Internal Server Error. The routes are like this $router->get(‘/’, function () use ($router) { return $router->app->version(); }); $router->get(‘users’, ‘[email protected]’); The controller is like this. class UserController extends Controller{ /** * Display a listing of the resource. * * @return IlluminateHttpResponse ..

Read more